Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Akamu
Game Server Go
Commits
4f93c356
Commit
4f93c356
authored
Dec 30, 2020
by
MaxGranzow
Committed by
Julien Schröter
Jan 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mock implementation of user recommendation endpoint for testing
parent
848d2ac6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
test/user_test.go
test/user_test.go
+10
-0
No files found.
test/user_test.go
View file @
4f93c356
...
...
@@ -150,6 +150,16 @@ func (mockUser) SelectByUsernameLike(username string) ([]schemas.InfoUserSchema,
return
users
,
nil
}
func
(
mockUser
)
SelectUserRecommendations
(
userID
uint32
,
count
uint32
)
([]
schemas
.
InfoUserSchema
,
error
)
{
var
users
[]
schemas
.
InfoUserSchema
for
_
,
u
:=
range
mockUsers
{
if
u
.
ID
!=
userID
{
users
=
append
(
users
,
getMockUserInfo
(
u
))
}
}
return
users
,
nil
}
// Users with IDs 1-3 have authentication. Everyone else will be rejected.
func
(
mockUser
)
Authenticate
(
name
string
,
password
string
)
(
uint32
,
error
)
{
if
correctpassword
,
ok
:=
mockUserPasswords
[
name
];
ok
&&
password
==
correctpassword
{
...
...
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