diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-11-09 22:01:26 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-11-10 12:51:51 +0100 |
commit | db3213fc1c653b20783f9a41074eaf17132010de (patch) | |
tree | 80668282d2ff9fd314d47bda96d3f53a4d31301d /spec/requests | |
parent | 7e4e3fb3b6177d2863580786e9ef6ee3a4ccf037 (diff) | |
download | gitlab-ce-db3213fc1c653b20783f9a41074eaf17132010de.tar.gz |
Use normal file upload mechanism to upload artifacts
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 0076730ef2f..233c15f87fe 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -194,8 +194,14 @@ describe Ci::API::API do build.run! end - it do - upload_artifacts(file_upload, headers_with_token) + it "uses regual file post" do + upload_artifacts(file_upload, headers_with_token, false) + expect(response.status).to eq(201) + expect(json_response["artifacts_file"]["filename"]).to eq(file_upload.original_filename) + end + + it "uses accelerated file post" do + upload_artifacts(file_upload, headers_with_token, true) expect(response.status).to eq(201) expect(json_response["artifacts_file"]["filename"]).to eq(file_upload.original_filename) end @@ -263,12 +269,15 @@ describe Ci::API::API do end end - def upload_artifacts(file, headers = {}) - params = { - file: file.path, - filename: file.original_filename, - } - post post_url, params, headers + def upload_artifacts(file, headers = {}, accelerated = true) + if accelerated + post post_url, { + 'file.path' => file.path, + 'file.name' => file.original_filename + }, headers + else + post post_url, { file: file }, headers + end end end |