Skip to content
Snippets Groups Projects
Commit 135be3ca authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Solve code review comments

parent dc296854
No related branches found
No related tags found
No related merge requests found
module Gitlab
module Auth
class Result < Struct.new(:actor, :project, :type, :authentication_abilities)
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
def ci?
type == :ci
end
Loading
Loading
Loading
Loading
@@ -263,6 +263,7 @@ describe Ci::API::API do
context "should authorize posting artifact to running build" do
it "using token as parameter" do
post authorize_url, { token: build.token }, headers
expect(response).to have_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response["TempPath"]).not_to be_nil
Loading
Loading
@@ -270,6 +271,7 @@ describe Ci::API::API do
 
it "using token as header" do
post authorize_url, {}, headers_with_token
expect(response).to have_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response["TempPath"]).not_to be_nil
Loading
Loading
@@ -277,6 +279,7 @@ describe Ci::API::API do
 
it "using runners token" do
post authorize_url, { token: build.project.runners_token }, headers
expect(response).to have_http_status(200)
expect(response.content_type.to_s).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response["TempPath"]).not_to be_nil
Loading
Loading
@@ -284,7 +287,9 @@ describe Ci::API::API do
 
it "reject requests that did not go through gitlab-workhorse" do
headers.delete(Gitlab::Workhorse::INTERNAL_API_REQUEST_HEADER)
post authorize_url, { token: build.token }, headers
expect(response).to have_http_status(500)
end
end
Loading
Loading
@@ -292,13 +297,17 @@ describe Ci::API::API do
context "should fail to post too large artifact" do
it "using token as parameter" do
stub_application_setting(max_artifacts_size: 0)
post authorize_url, { token: build.token, filesize: 100 }, headers
expect(response).to have_http_status(413)
end
 
it "using token as header" do
stub_application_setting(max_artifacts_size: 0)
post authorize_url, { filesize: 100 }, headers_with_token
expect(response).to have_http_status(413)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment