Skip to content

Commit

Permalink
Merge pull request #8687 from saraycp/all_requests_together
Browse files Browse the repository at this point in the history
Re-organize staging projects XML results
  • Loading branch information
coolo committed Nov 9, 2019
2 parents 5c746fd + 45d5b7f commit 17dd247
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
4 changes: 2 additions & 2 deletions docs/api/api/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ GET /staging/<staging_workflow_project>/staging_projects?requests=1&status=1&his
Get the overall state of all staging projects belonging to a staging workflow project.
Extra information can be requested by adding any combination of these parameters in the URL: requests, status and history.

- If requests is present, the output includes the staged requests.
- If requests is present, the output includes the staged, untracked and obsole requests as well as missing reviews.
- If status is present, the output includes the overall state and the status xml (broken packages, missing reviews, checks, etc.)
- If history is present, the output includes the history of the staging project.

Expand All @@ -1954,7 +1954,7 @@ GET /staging/<staging_workflow_project>/staging_projects/<staging_project>?reque
Get the overall state of a staging project.
Extra information can be requested by adding any combination of these parameters in the URL: requests, status and history.

- If requests is present, the output includes the staged requests.
- If requests is present, the output includes the staged, untracked and obsole requests as well as missing reviews.
- If status is present, the output includes the overall state and the status xml (broken packages, missing reviews, checks, etc.)
- If history is present, the output includes the history of the staging project.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ builder.staging_project(attributes) do
builder.staged_requests(count: staging_project.staged_requests.count) do
render(partial: 'staging/shared/requests', locals: { requests: staging_project.staged_requests, builder: builder })
end
end

if options[:status]
builder.untracked_requests(count: staging_project.untracked_requests.count) do
render(partial: 'staging/shared/requests', locals: { requests: staging_project.untracked_requests, builder: builder })
end
builder.requests_to_review(count: staging_project.requests_to_review.count) do
render(partial: 'staging/shared/requests', locals: { requests: staging_project.requests_to_review, builder: builder })
end
builder.obsolete_requests(count: staging_project.staged_requests.obsolete.count) do
render(partial: 'staging/shared/requests', locals: { requests: staging_project.staged_requests.obsolete, builder: builder })
end
render(partial: 'missing_reviews', locals: { missing_reviews: staging_project.missing_reviews,
count: staging_project.missing_reviews.count,
builder: builder })
end

if options[:status]
render(partial: 'building_repositories', locals: { building_repositories: staging_project.building_repositories,
count: staging_project.building_repositories.count,
builder: builder })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@
assert_select 'staging_project' do
assert_select 'staged_requests', 0
assert_select 'untracked_requests', 0
assert_select 'requests_to_review', 0
assert_select 'obsolete_requests', 0
assert_select 'missing_reviews', 0
assert_select 'broken_packages', 0
assert_select 'checks', 0
assert_select 'history', 0
end
end
end

context 'with staged requests' do
context 'with requests' do
before do
get :show, params: { staging_workflow_project: staging_workflow.project.name, staging_project_name: staging_project.name,
requests: 1, format: :xml }
Expand All @@ -119,15 +120,20 @@

it { expect(response.body).not_to include("<staging_project name=\"#{staging_project.name}\" state=") }

it 'returns the staging_project with staged requests xml' do
it 'returns the staging_project with requests xml' do
assert_select 'staging_project' do
assert_select 'staged_requests', 1 do
assert_select 'request', 3
end
assert_select 'untracked_requests', 0
assert_select 'requests_to_review', 0
assert_select 'missing_reviews', 0
assert_select 'untracked_requests', 1 do
assert_select 'request', 1
end
assert_select 'obsolete_requests', 1
assert_select 'missing_reviews', 1 do
assert_select 'review', 1
end
assert_select 'broken_packages', 0
assert_select 'checks', 0
assert_select 'history', 0
end
end
Expand All @@ -146,18 +152,13 @@
it 'returns the staging_project with status xml' do
assert_select 'staging_project' do
assert_select 'staged_requests', 0
assert_select 'untracked_requests', 1 do
assert_select 'request', 1
end
assert_select 'requests_to_review', 1 do
assert_select 'request', 2
end
assert_select 'missing_reviews', 1 do
assert_select 'review', 1
end
assert_select 'untracked_requests', 0
assert_select 'obsolete_requests', 0
assert_select 'missing_reviews', 0
assert_select 'broken_packages', 1 do
assert_select 'package', 1
end
assert_select 'checks', 1
assert_select 'history', 0
end
end
Expand All @@ -177,7 +178,7 @@
assert_select 'staging_project' do
assert_select 'staged_requests', 0
assert_select 'untracked_requests', 0
assert_select 'requests_to_review', 0
assert_select 'obsolete_requests', 0
assert_select 'missing_reviews', 0
assert_select 'broken_packages', 0
assert_select 'history', 1
Expand All @@ -203,9 +204,7 @@
assert_select 'untracked_requests', 1 do
assert_select 'request', 1
end
assert_select 'requests_to_review', 1 do
assert_select 'request', 2
end
assert_select 'obsolete_requests', 1
assert_select 'missing_reviews', 1 do
assert_select 'review', 1
end
Expand Down

0 comments on commit 17dd247

Please sign in to comment.