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
135be3ca
Commit
135be3ca
authored
Sep 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solve code review comments
parent
dc296854
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
lib/gitlab/auth/result.rb
lib/gitlab/auth/result.rb
+1
-1
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+9
-0
No files found.
lib/gitlab/auth/result.rb
View file @
135be3ca
module
Gitlab
module
Gitlab
module
Auth
module
Auth
class
Result
<
Struct
.
new
(
:actor
,
:project
,
:type
,
:authentication_abilities
)
Result
=
Struct
.
new
(
:actor
,
:project
,
:type
,
:authentication_abilities
)
do
def
ci?
def
ci?
type
==
:ci
type
==
:ci
end
end
...
...
spec/requests/ci/api/builds_spec.rb
View file @
135be3ca
...
@@ -263,6 +263,7 @@ describe Ci::API::API do
...
@@ -263,6 +263,7 @@ describe Ci::API::API do
context
"should authorize posting artifact to running build"
do
context
"should authorize posting artifact to running build"
do
it
"using token as parameter"
do
it
"using token as parameter"
do
post
authorize_url
,
{
token:
build
.
token
},
headers
post
authorize_url
,
{
token:
build
.
token
},
headers
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
json_response
[
"TempPath"
]).
not_to
be_nil
expect
(
json_response
[
"TempPath"
]).
not_to
be_nil
...
@@ -270,6 +271,7 @@ describe Ci::API::API do
...
@@ -270,6 +271,7 @@ describe Ci::API::API do
it
"using token as header"
do
it
"using token as header"
do
post
authorize_url
,
{},
headers_with_token
post
authorize_url
,
{},
headers_with_token
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
json_response
[
"TempPath"
]).
not_to
be_nil
expect
(
json_response
[
"TempPath"
]).
not_to
be_nil
...
@@ -277,6 +279,7 @@ describe Ci::API::API do
...
@@ -277,6 +279,7 @@ describe Ci::API::API do
it
"using runners token"
do
it
"using runners token"
do
post
authorize_url
,
{
token:
build
.
project
.
runners_token
},
headers
post
authorize_url
,
{
token:
build
.
project
.
runners_token
},
headers
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
response
.
content_type
.
to_s
).
to
eq
(
Gitlab
::
Workhorse
::
INTERNAL_API_CONTENT_TYPE
)
expect
(
json_response
[
"TempPath"
]).
not_to
be_nil
expect
(
json_response
[
"TempPath"
]).
not_to
be_nil
...
@@ -284,7 +287,9 @@ describe Ci::API::API do
...
@@ -284,7 +287,9 @@ describe Ci::API::API do
it
"reject requests that did not go through gitlab-workhorse"
do
it
"reject requests that did not go through gitlab-workhorse"
do
headers
.
delete
(
Gitlab
::
Workhorse
::
INTERNAL_API_REQUEST_HEADER
)
headers
.
delete
(
Gitlab
::
Workhorse
::
INTERNAL_API_REQUEST_HEADER
)
post
authorize_url
,
{
token:
build
.
token
},
headers
post
authorize_url
,
{
token:
build
.
token
},
headers
expect
(
response
).
to
have_http_status
(
500
)
expect
(
response
).
to
have_http_status
(
500
)
end
end
end
end
...
@@ -292,13 +297,17 @@ describe Ci::API::API do
...
@@ -292,13 +297,17 @@ describe Ci::API::API do
context
"should fail to post too large artifact"
do
context
"should fail to post too large artifact"
do
it
"using token as parameter"
do
it
"using token as parameter"
do
stub_application_setting
(
max_artifacts_size:
0
)
stub_application_setting
(
max_artifacts_size:
0
)
post
authorize_url
,
{
token:
build
.
token
,
filesize:
100
},
headers
post
authorize_url
,
{
token:
build
.
token
,
filesize:
100
},
headers
expect
(
response
).
to
have_http_status
(
413
)
expect
(
response
).
to
have_http_status
(
413
)
end
end
it
"using token as header"
do
it
"using token as header"
do
stub_application_setting
(
max_artifacts_size:
0
)
stub_application_setting
(
max_artifacts_size:
0
)
post
authorize_url
,
{
filesize:
100
},
headers_with_token
post
authorize_url
,
{
filesize:
100
},
headers_with_token
expect
(
response
).
to
have_http_status
(
413
)
expect
(
response
).
to
have_http_status
(
413
)
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