Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1249fb7e
Commit
1249fb7e
authored
Sep 08, 2021
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebase with master
parent
b68a7d87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+6
-10
No files found.
spec/requests/api/users_spec.rb
View file @
1249fb7e
...
...
@@ -9,6 +9,7 @@ RSpec.describe API::Users do
let_it_be
(
:gpg_key
)
{
create
(
:gpg_key
,
user:
user
)
}
let_it_be
(
:email
)
{
create
(
:email
,
user:
user
)
}
let
(
:blocked_user
)
{
create
(
:user
,
:blocked
)
}
let
(
:omniauth_user
)
{
create
(
:omniauth_user
)
}
let
(
:ldap_blocked_user
)
{
create
(
:omniauth_user
,
provider:
'ldapmain'
,
state:
'ldap_blocked'
)
}
let
(
:private_user
)
{
create
(
:user
,
private_profile:
true
)
}
...
...
@@ -2626,16 +2627,14 @@ RSpec.describe API::Users do
end
context
'for a blocked user'
do
before
do
user
.
block
end
let
(
:user_id
)
{
blocked_user
.
id
}
it
'returns 403'
do
activate
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'403 Forbidden - A blocked user must be unblocked to be activated'
)
expect
(
user
.
reload
.
state
).
to
eq
(
'blocked'
)
expect
(
blocked_
user
.
reload
.
state
).
to
eq
(
'blocked'
)
end
end
...
...
@@ -2723,16 +2722,14 @@ RSpec.describe API::Users do
end
context
'for a blocked user'
do
before
do
user
.
block
end
let
(
:user_id
)
{
blocked_user
.
id
}
it
'returns 403'
do
deactivate
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
json_response
[
'message'
]).
to
eq
(
'403 Forbidden - A blocked user cannot be deactivated by the API'
)
expect
(
user
.
reload
.
state
).
to
eq
(
'blocked'
)
expect
(
blocked_
user
.
reload
.
state
).
to
eq
(
'blocked'
)
end
end
...
...
@@ -2787,7 +2784,7 @@ RSpec.describe API::Users do
describe
'POST /users/:id/approve'
do
subject
(
:approve
)
{
post
api
(
"/users/
#{
user_id
}
/approve"
,
api_user
)
}
let_it_be
(
:
blocked_user
)
{
create
(
:user
,
:blocked
)
}
let_it_be
(
:
pending_user
)
{
create
(
:user
,
:blocked_pending_approval
)
}
context
'performed by a non-admin user'
do
let
(
:api_user
)
{
user
}
...
...
@@ -3006,7 +3003,6 @@ RSpec.describe API::Users do
end
context
'with a blocked user'
do
let
(
:blocked_user
)
{
create
(
:user
,
state:
'blocked'
)
}
let
(
:user_id
)
{
blocked_user
.
id
}
it
'returns a 201 if user is already blocked'
do
...
...
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