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
f1645bf7
Commit
f1645bf7
authored
Oct 11, 2018
by
JB Vasseur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unauthorized user tests and add non-authenticated user tests
parent
33c88f5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
spec/requests/api/applications_spec.rb
spec/requests/api/applications_spec.rb
+19
-3
No files found.
spec/requests/api/applications_spec.rb
View file @
f1645bf7
...
@@ -95,6 +95,14 @@ describe API::Applications, :api do
...
@@ -95,6 +95,14 @@ describe API::Applications, :api do
end
end
end
end
context
'authorized user without authorization'
do
it
'cannot list application'
do
get
api
(
'/applications'
,
user
)
expect
(
response
).
to
have_http_status
403
end
end
context
'non-authenticated user'
do
context
'non-authenticated user'
do
it
'cannot list application'
do
it
'cannot list application'
do
get
api
(
'/applications'
,
user
)
get
api
(
'/applications'
,
user
)
...
@@ -109,16 +117,24 @@ describe API::Applications, :api do
...
@@ -109,16 +117,24 @@ describe API::Applications, :api do
it
'can delete an application'
do
it
'can delete an application'
do
expect
do
expect
do
delete
api
(
"/applications/
#{
application
.
id
}
"
,
admin_user
)
delete
api
(
"/applications/
#{
application
.
id
}
"
,
admin_user
)
end
.
to
change
{
Doorkeeper
::
Application
.
count
}.
by
-
1
end
.
to
change
{
Doorkeeper
::
Application
.
count
}.
by
(
-
1
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
end
end
end
end
context
'
non-authenticated user
'
do
context
'
authorized user without authorization
'
do
it
'cannot delete an application'
do
it
'cannot delete an application'
do
delete
api
(
"/applications/
#{
application
.
id
}
"
,
user
)
delete
api
(
"/applications/
#{
application
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
403
end
end
context
'non-authenticated user'
do
it
'cannot delete an application'
do
delete
api
(
"/applications/
#{
application
.
id
}
"
)
expect
(
response
).
to
have_http_status
401
expect
(
response
).
to
have_http_status
401
end
end
end
end
...
...
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