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
5933cd1b
Commit
5933cd1b
authored
Apr 05, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the have_http_status matcher on the Geo API spec
parent
7a256b19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
spec/requests/api/geo_spec.rb
spec/requests/api/geo_spec.rb
+20
-14
No files found.
spec/requests/api/geo_spec.rb
View file @
5933cd1b
...
...
@@ -17,12 +17,14 @@ describe API::Geo, api: true do
describe
'POST /geo/receive_events authentication'
do
it
'denies access if token is not present'
do
post
api
(
'/geo/receive_events'
)
expect
(
response
.
status
).
to
eq
401
expect
(
response
).
to
have_http_status
(
401
)
end
it
'denies access if token is invalid'
do
post
api
(
'/geo/receive_events'
),
nil
,
{
'X-Gitlab-Token'
=>
'nothing'
}
expect
(
response
.
status
).
to
eq
401
expect
(
response
).
to
have_http_status
(
401
)
end
end
...
...
@@ -73,12 +75,14 @@ describe API::Geo, api: true do
it
'enqueues on disk key creation if admin and correct params'
do
post
api
(
'/geo/receive_events'
),
key_create_payload
,
geo_token_header
expect
(
response
.
status
).
to
eq
201
expect
(
response
).
to
have_http_status
(
201
)
end
it
'enqueues on disk key removal if admin and correct params'
do
post
api
(
'/geo/receive_events'
),
key_destroy_payload
,
geo_token_header
expect
(
response
.
status
).
to
eq
201
expect
(
response
).
to
have_http_status
(
201
)
end
end
...
...
@@ -98,7 +102,8 @@ describe API::Geo, api: true do
it
'starts refresh process if admin and correct params'
do
post
api
(
'/geo/receive_events'
),
push_payload
,
geo_token_header
expect
(
response
.
status
).
to
eq
201
expect
(
response
).
to
have_http_status
(
201
)
end
end
...
...
@@ -117,7 +122,8 @@ describe API::Geo, api: true do
it
'starts refresh process if admin and correct params'
do
post
api
(
'/geo/receive_events'
),
tag_push_payload
,
geo_token_header
expect
(
response
.
status
).
to
eq
201
expect
(
response
).
to
have_http_status
(
201
)
end
end
...
...
@@ -135,14 +141,14 @@ describe API::Geo, api: true do
it
'responds with 401 with invalid auth header'
do
get
api
(
"/geo/transfers/avatar/
#{
upload
.
id
}
"
),
nil
,
Authorization
:
'Test'
expect
(
response
.
status
).
to
eq
401
expect
(
response
).
to
have_http_status
(
401
)
end
context
'avatar file exists'
do
it
'responds with 200 with X-Sendfile'
do
get
api
(
"/geo/transfers/avatar/
#{
upload
.
id
}
"
),
nil
,
req_header
expect
(
response
.
status
).
to
eq
200
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
[
'Content-Type'
]).
to
eq
(
'application/octet-stream'
)
expect
(
response
.
headers
[
'X-Sendfile'
]).
to
eq
(
user
.
avatar
.
path
)
end
...
...
@@ -152,7 +158,7 @@ describe API::Geo, api: true do
it
'responds with 404'
do
get
api
(
"/geo/transfers/avatar/100000"
),
nil
,
req_header
expect
(
response
.
status
).
to
eq
404
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
...
...
@@ -172,14 +178,14 @@ describe API::Geo, api: true do
it
'responds with 401 with invalid auth header'
do
get
api
(
"/geo/transfers/lfs/
#{
lfs_object
.
id
}
"
),
nil
,
Authorization
:
'Test'
expect
(
response
.
status
).
to
eq
401
expect
(
response
).
to
have_http_status
(
401
)
end
context
'LFS file exists'
do
it
'responds with 200 with X-Sendfile'
do
get
api
(
"/geo/transfers/lfs/
#{
lfs_object
.
id
}
"
),
nil
,
req_header
expect
(
response
.
status
).
to
eq
200
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
[
'Content-Type'
]).
to
eq
(
'application/octet-stream'
)
expect
(
response
.
headers
[
'X-Sendfile'
]).
to
eq
(
lfs_object
.
file
.
path
)
end
...
...
@@ -189,7 +195,7 @@ describe API::Geo, api: true do
it
'responds with 404'
do
get
api
(
"/geo/transfers/lfs/100000"
),
nil
,
req_header
expect
(
response
.
status
).
to
eq
404
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
...
...
@@ -201,7 +207,7 @@ describe API::Geo, api: true do
it
'responds with 401 with invalid auth header'
do
get
api
(
'/geo/status'
),
nil
,
Authorization
:
'Test'
expect
(
response
.
status
).
to
eq
401
expect
(
response
).
to
have_http_status
(
401
)
end
context
'when requesting secondary node with valid auth header'
do
...
...
@@ -213,7 +219,7 @@ describe API::Geo, api: true do
it
'responds with 200'
do
get
api
(
'/geo/status'
),
nil
,
request
.
headers
expect
(
response
.
status
).
to
eq
200
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
[
'Content-Type'
]).
to
eq
(
'application/json'
)
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