From bec660b1232045489e28595811ddf1860ddcb587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Fri, 3 Mar 2017 14:32:35 +0100 Subject: [PATCH] [ci] Test source_controller#update_project_config It is called in teh old test suite from `project_controller_tests.rb#test_updating_config_file`. --- .../PUT_update_project_config/1_5_1.yml | 79 +++++++++++++ .../PUT_update_project_config/1_5_2.yml | 110 ++++++++++++++++++ .../PUT_update_project_config/1_5_3.yml | 110 ++++++++++++++++++ .../controllers/source_controller_spec.rb | 16 ++- 4 files changed, 312 insertions(+), 3 deletions(-) create mode 100644 src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_1.yml create mode 100644 src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_2.yml create mode 100644 src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_3.yml diff --git a/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_1.yml b/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_1.yml new file mode 100644 index 00000000000..2657420c073 --- /dev/null +++ b/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_1.yml @@ -0,0 +1,79 @@ +--- +http_interactions: +- request: + method: put + uri: http://localhost:3200/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 03 Mar 2017 13:21:13 GMT +- request: + method: put + uri: http://localhost:3200/source/home:tom/_config?comment=Updated%20by%20test&user=tom + body: + encoding: ASCII-8BIT + string: comment=Updated+by+test + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Content-Length: + - '23' + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '21' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 03 Mar 2017 13:31:55 GMT +recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_2.yml b/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_2.yml new file mode 100644 index 00000000000..ccafa0133b9 --- /dev/null +++ b/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_2.yml @@ -0,0 +1,110 @@ +--- +http_interactions: +- request: + method: put + uri: http://localhost:3200/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Mon, 06 Mar 2017 12:10:48 GMT +- request: + method: put + uri: http://localhost:3200/source/home:tom/_config?comment=Updated%20by%20test&user=tom + body: + encoding: ASCII-8BIT + string: comment=Updated+by+test + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Content-Length: + - '23' + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '21' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Mon, 06 Mar 2017 12:10:49 GMT +- request: + method: get + uri: http://localhost:3200/source/home:tom/_config + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/plain + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '23' + body: + encoding: UTF-8 + string: comment=Updated+by+test + http_version: + recorded_at: Mon, 06 Mar 2017 13:14:33 GMT +recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_3.yml b/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_3.yml new file mode 100644 index 00000000000..c61d7152056 --- /dev/null +++ b/src/api/spec/cassettes/SourceController/PUT_update_project_config/1_5_3.yml @@ -0,0 +1,110 @@ +--- +http_interactions: +- request: + method: put + uri: http://localhost:3200/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Wed, 08 Mar 2017 13:30:16 GMT +- request: + method: put + uri: http://localhost:3200/source/home:tom/_config?comment=Updated%20by%20test&user=tom + body: + encoding: ASCII-8BIT + string: comment=Updated+by+test + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Content-Length: + - '23' + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '21' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Wed, 08 Mar 2017 13:30:17 GMT +- request: + method: get + uri: http://localhost:3200/source/home:tom/_config + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/plain + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '23' + body: + encoding: UTF-8 + string: comment=Updated+by+test + http_version: + recorded_at: Wed, 08 Mar 2017 13:30:17 GMT +recorded_with: VCR 3.0.3 diff --git a/src/api/spec/controllers/source_controller_spec.rb b/src/api/spec/controllers/source_controller_spec.rb index 50ba156df05..29901e9bfc1 100644 --- a/src/api/spec/controllers/source_controller_spec.rb +++ b/src/api/spec/controllers/source_controller_spec.rb @@ -4,6 +4,9 @@ # CONFIG['global_write_through'] = true RSpec.describe SourceController, vcr: true do + let(:user) { create(:confirmed_user, login: "tom") } + let(:project) { user.home_project } + describe "POST #global_command_orderkiwirepos" do it "is accessible anonymously and forwards backend errors" do post :global_command_orderkiwirepos, params: { cmd: "orderkiwirepos" } @@ -29,9 +32,6 @@ end describe "GET #show_project_meta" do - let(:user) { create(:confirmed_user, login: "tom") } - let(:project) { user.home_project } - before do login user get :show_project_meta, params: { project: project } @@ -40,4 +40,14 @@ it { expect(response).to be_success } it { expect(Xmlhash.parse(response.body)["name"]).to eq(project.name) } end + + describe "PUT #update_project_config" do + before do + login user + put :update_project_config, params: { project: project, comment: 'Updated by test' } + end + + it { expect(response).to be_success } + it { expect(project.config.to_s).to include('Updated', 'by', 'test') } + end end