Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
3cea815f
Commit
3cea815f
authored
4 years ago
by
Jože Fortun
Browse files
Options
Download
Email Patches
Plain Diff
Use truncAndCreate when available in store tests
parent
fa322038
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
4 additions
and
19 deletions
+4
-19
store/tests/messaging_channels_test.go
store/tests/messaging_channels_test.go
+1
-2
store/tests/messaging_flags_test.go
store/tests/messaging_flags_test.go
+1
-2
store/tests/messaging_mentions_test.go
store/tests/messaging_mentions_test.go
+1
-2
store/tests/messaging_messages_test.go
store/tests/messaging_messages_test.go
+1
-2
store/tests/reminders_test.go
store/tests/reminders_test.go
+0
-1
store/tests/roles_test.go
store/tests/roles_test.go
+0
-2
store/tests/settings_test.go
store/tests/settings_test.go
+0
-1
store/tests/users_test.go
store/tests/users_test.go
+0
-7
No files found.
store/tests/messaging_channels_test.go
View file @
3cea815f
...
...
@@ -44,8 +44,7 @@ func testMessagingChannels(t *testing.T, s store.MessagingChannels) {
})
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
messagingChannel
:=
makeNew
(
"look up by id"
)
req
.
NoError
(
s
.
CreateMessagingChannel
(
ctx
,
messagingChannel
))
req
,
messagingChannel
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupMessagingChannelByID
(
ctx
,
messagingChannel
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
messagingChannel
.
Name
,
fetched
.
Name
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/messaging_flags_test.go
View file @
3cea815f
...
...
@@ -50,8 +50,7 @@ func testMessagingFlags(t *testing.T, s store.MessagingFlags) {
})
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
messagingFlag
:=
makeNew
(
"look-up-by-id"
)
req
.
NoError
(
s
.
CreateMessagingFlag
(
ctx
,
messagingFlag
))
req
,
messagingFlag
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupMessagingFlagByID
(
ctx
,
messagingFlag
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
messagingFlag
.
Flag
,
fetched
.
Flag
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/messaging_mentions_test.go
View file @
3cea815f
...
...
@@ -49,8 +49,7 @@ func testMessagingMentions(t *testing.T, s store.MessagingMentions) {
})
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
messagingMention
:=
makeNew
(
"look-up-by-id"
)
req
.
NoError
(
s
.
CreateMessagingMention
(
ctx
,
messagingMention
))
req
,
messagingMention
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupMessagingMentionByID
(
ctx
,
messagingMention
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
messagingMention
.
ID
,
fetched
.
ID
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/messaging_messages_test.go
View file @
3cea815f
...
...
@@ -47,8 +47,7 @@ func testMessagingMessages(t *testing.T, s store.MessagingMessages) {
})
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
messagingMessage
:=
makeNew
(
"look up by id"
)
req
.
NoError
(
s
.
CreateMessagingMessage
(
ctx
,
messagingMessage
))
req
,
messagingMessage
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupMessagingMessageByID
(
ctx
,
messagingMessage
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
messagingMessage
.
Message
,
fetched
.
Message
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/reminders_test.go
View file @
3cea815f
...
...
@@ -60,7 +60,6 @@ func testReminders(t *testing.T, s store.Reminders) {
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
req
,
reminder
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupReminderByID
(
ctx
,
reminder
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
reminder
.
ID
,
fetched
.
ID
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/roles_test.go
View file @
3cea815f
...
...
@@ -58,7 +58,6 @@ func testRoles(t *testing.T, s store.Roles) {
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
req
,
role
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupRoleByID
(
ctx
,
role
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
role
.
Name
,
fetched
.
Name
)
...
...
@@ -76,7 +75,6 @@ func testRoles(t *testing.T, s store.Roles) {
t
.
Run
(
"lookup by handle"
,
func
(
t
*
testing
.
T
)
{
req
,
role
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupRoleByHandle
(
ctx
,
role
.
Handle
)
req
.
NoError
(
err
)
req
.
Equal
(
role
.
ID
,
fetched
.
ID
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/settings_test.go
View file @
3cea815f
...
...
@@ -54,7 +54,6 @@ func testSettings(t *testing.T, s store.Settings) {
t
.
Run
(
"lookup by name and ownedBy"
,
func
(
t
*
testing
.
T
)
{
req
,
setting
:=
truncAndCreate
(
t
)
fetched
,
err
:=
s
.
LookupSettingByNameOwnedBy
(
ctx
,
setting
.
Name
,
setting
.
OwnedBy
)
req
.
NoError
(
err
)
req
.
Equal
(
setting
.
Name
,
fetched
.
Name
)
...
...
This diff is collapsed.
Click to expand it.
store/tests/users_test.go
View file @
3cea815f
...
...
@@ -99,7 +99,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"lookup by ID"
,
func
(
t
*
testing
.
T
)
{
req
,
user
:=
truncAndCreate
(
t
)
fetched
,
err
:=
store
.
LookupUserByID
(
ctx
,
s
,
user
.
ID
)
req
.
NoError
(
err
)
req
.
Equal
(
user
.
Email
,
fetched
.
Email
)
...
...
@@ -119,7 +118,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"lookup by email"
,
func
(
t
*
testing
.
T
)
{
req
,
user
:=
truncAndCreate
(
t
)
fetched
,
err
:=
store
.
LookupUserByEmail
(
ctx
,
s
,
user
.
Email
)
req
.
NoError
(
err
)
req
.
Equal
(
user
.
Email
,
fetched
.
Email
)
...
...
@@ -127,7 +125,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"lookup by handle"
,
func
(
t
*
testing
.
T
)
{
req
,
user
:=
truncAndCreate
(
t
)
fetched
,
err
:=
store
.
LookupUserByHandle
(
ctx
,
s
,
user
.
Handle
)
req
.
NoError
(
err
)
req
.
Equal
(
user
.
ID
,
fetched
.
ID
)
...
...
@@ -135,7 +132,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"lookup by nonexisting handle"
,
func
(
t
*
testing
.
T
)
{
req
,
_
:=
truncAndCreate
(
t
)
fetched
,
err
:=
store
.
LookupUserByHandle
(
ctx
,
s
,
"no such handle"
)
req
.
EqualError
(
err
,
"not found"
)
req
.
Nil
(
fetched
)
...
...
@@ -143,7 +139,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"lookup by username"
,
func
(
t
*
testing
.
T
)
{
req
,
user
:=
truncAndCreate
(
t
)
fetched
,
err
:=
store
.
LookupUserByUsername
(
ctx
,
s
,
user
.
Username
)
req
.
NoError
(
err
)
req
.
Equal
(
user
.
ID
,
fetched
.
ID
)
...
...
@@ -152,7 +147,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"search"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"by ID"
,
func
(
t
*
testing
.
T
)
{
req
,
prefill
:=
truncAndFill
(
t
,
5
)
set
,
f
,
err
:=
store
.
SearchUsers
(
ctx
,
s
,
types
.
UserFilter
{
UserID
:
[]
uint64
{
prefill
[
0
]
.
ID
}})
req
.
NoError
(
err
)
req
.
Equal
([]
uint64
{
prefill
[
0
]
.
ID
},
f
.
UserID
)
...
...
@@ -162,7 +156,6 @@ func testUsers(t *testing.T, s store.Users) {
t
.
Run
(
"by email"
,
func
(
t
*
testing
.
T
)
{
req
,
prefill
:=
truncAndFill
(
t
,
5
)
set
,
_
,
err
:=
store
.
SearchUsers
(
ctx
,
s
,
types
.
UserFilter
{
Email
:
prefill
[
0
]
.
Email
})
req
.
NoError
(
err
)
req
.
Len
(
set
,
1
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment