From c4f815f89f0ac58a2d7ee3653cf2697f6048fcff Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 19 Nov 2019 13:57:11 +0100 Subject: [PATCH] Stage all requests, but only link submit requests Fixes #8738 --- src/api/app/models/staging/staged_requests.rb | 27 +- .../with_delete_request/1_2_6_1.yml | 291 ++++++++++++++ .../with_delete_request/1_2_6_2.yml | 291 ++++++++++++++ .../with_delete_request/1_2_6_3.yml | 369 ++++++++++++++++++ .../with_delete_request/1_2_6_4.yml | 291 ++++++++++++++ .../staged_requests_controller_spec.rb | 14 + 6 files changed, 1266 insertions(+), 17 deletions(-) create mode 100644 src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_1.yml create mode 100644 src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_2.yml create mode 100644 src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_3.yml create mode 100644 src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_4.yml diff --git a/src/api/app/models/staging/staged_requests.rb b/src/api/app/models/staging/staged_requests.rb index 9691968772f..98e47b6579a 100644 --- a/src/api/app/models/staging/staged_requests.rb +++ b/src/api/app/models/staging/staged_requests.rb @@ -11,10 +11,18 @@ def create link_package(bs_request_action) end # TODO: implement delete requests + ProjectLogEntry.create!( + project: staging_project, + user_name: user_login, + bs_request: request, + event_type: :staged_request, + datetime: Time.now, + package_name: bs_request_action.target_package + ) + staging_project.staged_requests << request + add_review_for_staged_request(request) end - result.each { |request| add_review_for_staged_request(request) } - self end @@ -64,10 +72,6 @@ def valid? private - def result - @result ||= [] - end - def not_removed_packages @not_removed_packages ||= {} end @@ -129,17 +133,6 @@ def link_package(bs_request_action) create_link(staging_project.name, link_package.name, User.session!, project: source_package.project.name, package: source_package.name, rev: package_rev, vrev: source_vrev) - - ProjectLogEntry.create!( - project: staging_project, - user_name: user_login, - bs_request: request, - event_type: :staged_request, - datetime: Time.now, - package_name: bs_request_action.target_package - ) - staging_project.staged_requests << request - result << request end def add_review_for_staged_request(request) diff --git a/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_1.yml b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_1.yml new file mode 100644 index 00000000000..1eea92cbee7 --- /dev/null +++ b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_1.yml @@ -0,0 +1,291 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" 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: + - '150' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:06 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + 51c9efc0e3af150a7050f33167ad159a + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:06 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:A/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-38" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:A"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:06 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + baac9d49963dadc2d63d7bbd70f93a23 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:07 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:B/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-38" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:B"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:07 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" role="maintainer"/> + <group groupid="staging-workflow-managers-38" role="reviewer"/> + </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: + - '216' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:07 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/target_package/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + Terrible Swift Sword + Enim dolores suscipit ut. + + 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: + - '166' + body: + encoding: UTF-8 + string: | + + Terrible Swift Sword + Enim dolores suscipit ut. + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:07 GMT +recorded_with: VCR 5.0.0 diff --git a/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_2.yml b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_2.yml new file mode 100644 index 00000000000..998562a52e3 --- /dev/null +++ b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_2.yml @@ -0,0 +1,291 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" 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: + - '150' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:03 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + c228be0511d8c9d47dabdf5b8eb8c4a7 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:04 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:A/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-36" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:A"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:04 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + 4bbfde125d0c02727f8900ec6b3384e5 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:04 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:B/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-36" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:B"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:04 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" role="maintainer"/> + <group groupid="staging-workflow-managers-36" role="reviewer"/> + </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: + - '216' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:04 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/target_package/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + The Stars' Tennis Balls + Porro veritatis pariatur est. + + 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: + - '173' + body: + encoding: UTF-8 + string: | + + The Stars' Tennis Balls + Porro veritatis pariatur est. + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:04 GMT +recorded_with: VCR 5.0.0 diff --git a/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_3.yml b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_3.yml new file mode 100644 index 00000000000..67477479aec --- /dev/null +++ b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_3.yml @@ -0,0 +1,369 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" 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: + - '150' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:02 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + f669960b1211d27876573b87d1b9c4a9 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:02 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:A/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-35" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:A"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:02 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + 2814751734c3efd542cfd92fec476d60 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:02 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:B/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-35" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:B"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:02 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" role="maintainer"/> + <group groupid="staging-workflow-managers-35" role="reviewer"/> + </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: + - '216' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:02 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/target_package/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + The Proper Study + Sed est id neque. + + 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: + - '154' + body: + encoding: UTF-8 + string: | + + The Proper Study + Sed est id neque. + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:03 GMT +- request: + method: put + uri: http://backend:5352/source/source_project/_meta?user=user_72 + body: + encoding: UTF-8 + string: | + + Stranger in a Strange Land + + + 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: + - '117' + body: + encoding: UTF-8 + string: | + + Stranger in a Strange Land + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:03 GMT +- request: + method: put + uri: http://backend:5352/source/source_project/source_package/_meta?user=user_73 + body: + encoding: UTF-8 + string: | + + The Curious Incident of the Dog in the Night-Time + Quidem itaque accusamus dolorem. + + 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: + - '197' + body: + encoding: UTF-8 + string: | + + The Curious Incident of the Dog in the Night-Time + Quidem itaque accusamus dolorem. + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:03 GMT +recorded_with: VCR 5.0.0 diff --git a/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_4.yml b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_4.yml new file mode 100644 index 00000000000..688aa66d429 --- /dev/null +++ b/src/api/spec/cassettes/Staging_StagedRequestsController/POST_create/with_delete_request/1_2_6_4.yml @@ -0,0 +1,291 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" 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: + - '150' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + 7253cec41faa42997c0a282c5b0b3415 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:A/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-37" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:A"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_project/_staging_workflow?user=permitted_user + body: + encoding: UTF-8 + 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/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '177' + body: + encoding: UTF-8 + string: | + + aa58e05364de129dc292201b547d2d35 + + permitted_user + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user:Staging:B/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <group groupid="staging-workflow-managers-37" 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: + - '174' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user:Staging:B"> + <title> + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="permitted_user" role="maintainer"/> + <group groupid="staging-workflow-managers-37" role="reviewer"/> + </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: + - '216' + body: + encoding: UTF-8 + string: | + <project name="home:permitted_user"> + <title> + + + + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +- request: + method: put + uri: http://backend:5352/source/home:permitted_user/target_package/_meta?user=permitted_user + body: + encoding: UTF-8 + string: | + + No Highway + Dignissimos et quaerat et. + + 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: + - '157' + body: + encoding: UTF-8 + string: | + + No Highway + Dignissimos et quaerat et. + + http_version: + recorded_at: Tue, 19 Nov 2019 12:51:05 GMT +recorded_with: VCR 5.0.0 diff --git a/src/api/spec/controllers/staging/staged_requests_controller_spec.rb b/src/api/spec/controllers/staging/staged_requests_controller_spec.rb index 7be05910d96..97173ad598a 100644 --- a/src/api/spec/controllers/staging/staged_requests_controller_spec.rb +++ b/src/api/spec/controllers/staging/staged_requests_controller_spec.rb @@ -22,6 +22,7 @@ number: 1, review_by_group: group) end + let(:delete_request) { create(:delete_bs_request, target_package: target_package) } describe 'GET #index' do before do @@ -101,6 +102,19 @@ it { assert_select 'status[code=ok]' } end + context 'with delete request', vcr: true do + before do + login user + post :create, params: { staging_workflow_project: staging_workflow.project.name, staging_project_name: staging_project.name, format: :xml }, + body: "#{delete_request.number}" + end + + it { expect(response).to have_http_status(:success) } + it { expect(staging_project.packages.pluck(:name)).not_to include(target_package.name) } + it { expect(staging_project.staged_requests).to include(delete_request) } + it { assert_select 'status[code=ok]' } + end + context 'with an excluded request', vcr: true do subject do login user