Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect tasks subcollection to request_tasks #15357

Merged
merged 2 commits into from
Jun 14, 2017
Merged

Redirect tasks subcollection to request_tasks #15357

merged 2 commits into from
Jun 14, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Jun 12, 2017

This is a continuation of #15265 which resolves BZ https://bugzilla.redhat.com/show_bug.cgi?id=1442087

Taking Tim's suggestion, I thought it was best to implement a redirect which returns a 301 "Moved Permanently" and provides all the necessary information. A "Bad Request" response does not make as much sense in this case, and this will be a solid step before removing it.

thoughts @abellotti @imtayadeway ?
@miq-bot add_label api, bug
@miq-bot assign @abellotti

run_get("#{automation_requests_url(automation_request.id)}/tasks")

expect(response).to have_http_status(:moved_permanently)
expect(response.redirect?).to be_truthy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this expectation is redundant - the one above checks that it is a 301, this one checks that it is in the set of many redirect codes

expect(response.redirect?).to be_truthy
expect(response.redirect_url).to include("#{automation_requests_url(automation_request.id)}/request_tasks")

run_get response.redirect_url, :expand => :resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I like the idea of testing the whole flow of being redirected in this test, on the flip side this could also be a test duplication. I think we could assume that this subsequent request will do the right thing, especially if it is tested elsewhere (assuming it is). So I'm not sure this extra check is necessary. WDYT?

@miq-bot
Copy link
Member

miq-bot commented Jun 13, 2017

Checked commits jntullo/manageiq@2226ad2~...bfe378b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
9 files checked, 0 offenses detected
Everything looks fine. 👍

Copy link
Contributor

@imtayadeway imtayadeway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 LGTM!

@abellotti
Copy link
Member

Nice PR# @jntullo (and @imtayadeway for the suggestion/help. customers will get the 301 and their calls will continue to work. we'd still document the deprecation/redirect in 3.0.0. Thanks!!

@abellotti abellotti added this to the Sprint 63 Ending Jun 19, 2017 milestone Jun 14, 2017
@abellotti
Copy link
Member

LGTM!! 😍

@abellotti abellotti closed this Jun 14, 2017
@abellotti abellotti reopened this Jun 14, 2017
@abellotti abellotti merged commit 0160d47 into ManageIQ:master Jun 14, 2017
@jntullo jntullo deleted the bz/redirect_tasks branch November 28, 2017 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants