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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
c47aea75
Commit
c47aea75
authored
Oct 15, 2018
by
JB Vasseur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use have_gitlab_http_status following best practices !22296
parent
abf7c10b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
spec/requests/api/applications_spec.rb
spec/requests/api/applications_spec.rb
+11
-11
No files found.
spec/requests/api/applications_spec.rb
View file @
c47aea75
...
...
@@ -16,7 +16,7 @@ describe API::Applications, :api do
application
=
Doorkeeper
::
Application
.
find_by
(
name:
'application_name'
,
redirect_uri:
'http://application.url'
)
expect
(
response
).
to
have_
http_status
201
expect
(
response
).
to
have_
gitlab_http_status
(
201
)
expect
(
json_response
).
to
be_a
Hash
expect
(
json_response
[
'application_id'
]).
to
eq
application
.
uid
expect
(
json_response
[
'secret'
]).
to
eq
application
.
secret
...
...
@@ -28,7 +28,7 @@ describe API::Applications, :api do
post
api
(
'/applications'
,
admin_user
),
name:
'application_name'
,
redirect_uri:
'wrong_url_format'
,
scopes:
''
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
have_
http_status
400
expect
(
response
).
to
have_
gitlab_http_status
(
400
)
expect
(
json_response
).
to
be_a
Hash
expect
(
json_response
[
'message'
][
'redirect_uri'
][
0
]).
to
eq
(
'must be an absolute URI.'
)
end
...
...
@@ -38,7 +38,7 @@ describe API::Applications, :api do
post
api
(
'/applications'
,
admin_user
),
redirect_uri:
'http://application.url'
,
scopes:
''
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
have_
http_status
400
expect
(
response
).
to
have_
gitlab_http_status
(
400
)
expect
(
json_response
).
to
be_a
Hash
expect
(
json_response
[
'error'
]).
to
eq
(
'name is missing'
)
end
...
...
@@ -48,7 +48,7 @@ describe API::Applications, :api do
post
api
(
'/applications'
,
admin_user
),
name:
'application_name'
,
scopes:
''
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
have_
http_status
400
expect
(
response
).
to
have_
gitlab_http_status
(
400
)
expect
(
json_response
).
to
be_a
Hash
expect
(
json_response
[
'error'
]).
to
eq
(
'redirect_uri is missing'
)
end
...
...
@@ -58,7 +58,7 @@ describe API::Applications, :api do
post
api
(
'/applications'
,
admin_user
),
name:
'application_name'
,
redirect_uri:
'http://application.url'
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
have_
http_status
400
expect
(
response
).
to
have_
gitlab_http_status
(
400
)
expect
(
json_response
).
to
be_a
Hash
expect
(
json_response
[
'error'
]).
to
eq
(
'scopes is missing'
)
end
...
...
@@ -70,7 +70,7 @@ describe API::Applications, :api do
post
api
(
'/applications'
,
user
),
name:
'application_name'
,
redirect_uri:
'http://application.url'
,
scopes:
''
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
have_
http_status
403
expect
(
response
).
to
have_
gitlab_http_status
(
403
)
end
end
...
...
@@ -80,7 +80,7 @@ describe API::Applications, :api do
post
api
(
'/applications'
),
name:
'application_name'
,
redirect_uri:
'http://application.url'
end
.
not_to
change
{
Doorkeeper
::
Application
.
count
}
expect
(
response
).
to
have_
http_status
401
expect
(
response
).
to
have_
gitlab_http_status
(
401
)
end
end
end
...
...
@@ -99,7 +99,7 @@ describe API::Applications, :api do
it
'cannot list application'
do
get
api
(
'/applications'
,
user
)
expect
(
response
).
to
have_
http_status
403
expect
(
response
).
to
have_
gitlab_http_status
(
403
)
end
end
...
...
@@ -107,7 +107,7 @@ describe API::Applications, :api do
it
'cannot list application'
do
get
api
(
'/applications'
)
expect
(
response
).
to
have_
http_status
401
expect
(
response
).
to
have_
gitlab_http_status
(
401
)
end
end
end
...
...
@@ -127,7 +127,7 @@ describe API::Applications, :api do
it
'cannot delete an application'
do
delete
api
(
"/applications/
#{
application
.
id
}
"
,
user
)
expect
(
response
).
to
have_
http_status
403
expect
(
response
).
to
have_
gitlab_http_status
(
403
)
end
end
...
...
@@ -135,7 +135,7 @@ describe API::Applications, :api do
it
'cannot delete an application'
do
delete
api
(
"/applications/
#{
application
.
id
}
"
)
expect
(
response
).
to
have_
http_status
401
expect
(
response
).
to
have_
gitlab_http_status
(
401
)
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