Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
d6cc43b2
Commit
d6cc43b2
authored
Apr 27, 2018
by
Joe Rocklin
Committed by
Sander van Harmelen
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error names based on linter output
parent
5e1c7f37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
users.go
users.go
+7
-7
users_test.go
users_test.go
+8
-8
No files found.
users.go
View file @
d6cc43b2
...
...
@@ -22,9 +22,9 @@ import (
)
var
(
UserBlockPreventedError
=
fmt
.
Errorf
(
"Cannot block a user that is already blocked by LDAP synchronization"
)
UserNotFoundError
=
fmt
.
Errorf
(
"User does not exist"
)
UserUnblockPreventedError
=
fmt
.
Errorf
(
"Cannot unblock a user that is blocked by LDAP synchronization"
)
ErrUserBlockPrevented
=
fmt
.
Errorf
(
"Cannot block a user that is already blocked by LDAP synchronization"
)
ErrUserNotFound
=
fmt
.
Errorf
(
"User does not exist"
)
ErrUserUnblockPrevented
=
fmt
.
Errorf
(
"Cannot unblock a user that is blocked by LDAP synchronization"
)
)
// UsersService handles communication with the user related methods of
...
...
@@ -438,9 +438,9 @@ func (s *UsersService) BlockUser(user int, options ...OptionFunc) error {
case
201
:
return
nil
case
403
:
return
UserBlockPreventedError
return
ErrUserBlockPrevented
case
404
:
return
UserNotFoundError
return
ErrUserNotFound
default
:
return
fmt
.
Errorf
(
"Received unexpected result code: %d"
,
resp
.
StatusCode
)
}
...
...
@@ -466,9 +466,9 @@ func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error {
case
201
:
return
nil
case
403
:
return
UserUnblockPreventedError
return
ErrUserUnblockPrevented
case
404
:
return
UserNotFoundError
return
ErrUserNotFound
default
:
return
fmt
.
Errorf
(
"Received unexpected result code: %d"
,
resp
.
StatusCode
)
}
...
...
users_test.go
View file @
d6cc43b2
...
...
@@ -32,8 +32,8 @@ func TestBlockUser_UserNotFound(t *testing.T) {
})
err
:=
client
.
Users
.
BlockUser
(
1
)
if
err
!=
UserNotFoundError
{
t
.
Errorf
(
"Users.BlockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
UserNotFoundError
,
err
)
if
err
!=
ErrUserNotFound
{
t
.
Errorf
(
"Users.BlockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
ErrUserNotFound
,
err
)
}
}
...
...
@@ -47,8 +47,8 @@ func TestBlockUser_BlockPrevented(t *testing.T) {
})
err
:=
client
.
Users
.
BlockUser
(
1
)
if
err
!=
UserBlockPreventedError
{
t
.
Errorf
(
"Users.BlockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
UserBlockPreventedError
,
err
)
if
err
!=
ErrUserBlockPrevented
{
t
.
Errorf
(
"Users.BlockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
ErrUserBlockPrevented
,
err
)
}
}
...
...
@@ -107,8 +107,8 @@ func TestUnblockUser_UserNotFound(t *testing.T) {
})
err
:=
client
.
Users
.
UnblockUser
(
1
)
if
err
!=
UserNotFoundError
{
t
.
Errorf
(
"Users.UnblockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
UserNotFoundError
,
err
)
if
err
!=
ErrUserNotFound
{
t
.
Errorf
(
"Users.UnblockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
ErrUserNotFound
,
err
)
}
}
...
...
@@ -122,8 +122,8 @@ func TestUnblockUser_UnblockPrevented(t *testing.T) {
})
err
:=
client
.
Users
.
UnblockUser
(
1
)
if
err
!=
UserUnblockPreventedError
{
t
.
Errorf
(
"Users.UnblockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
UserUnblockPreventedError
,
err
)
if
err
!=
ErrUserUnblockPrevented
{
t
.
Errorf
(
"Users.UnblockUser error.
\n
Expected: %+v
\n
Got: %+v"
,
ErrUserUnblockPrevented
,
err
)
}
}
...
...
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