Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Create 1.4 compatible HttpResponseRedirect object. #1623

Merged
merged 1 commit into from
Feb 10, 2015

Conversation

ipanova
Copy link
Member

@ipanova ipanova commented Feb 10, 2015

@pulpbot
Copy link
Member

pulpbot commented Feb 10, 2015

Refer to this link for build results (access rights to CI server needed):
https://pulp-jenkins.rhev-ci-vms.eng.rdu2.redhat.com//job/unittest-pulp-pr/125/
Test PASSed.

@bmbouter bmbouter self-assigned this Feb 10, 2015
@bmbouter
Copy link
Member

I expected the branch name to be '149' but instead it is 'task149'. All tasks, issues, stories, etc in Redmine share the same numbering sequence so '149' as the branch name specifies some clearly. This does not need to be adjusted for this PR, just something I observed.

@bmbouter
Copy link
Member

Typically the redmine issue is linked to in the PR description.

Test HttpResponseRedirect.
"""
test_content = {'foo': 'bar'}
response = util.generate_json_response_with_pulp_encoder(test_content)
Copy link
Member

Choose a reason for hiding this comment

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

Can this call to utils.generate_json_response_with_pulp_encoder build the object manually? A simple HttpResponse(content=test_content) should suffice. This way the unit test won't be affected by breakages in utils.generate_json_response_with_pulp_encoder.

Copy link
Member Author

Choose a reason for hiding this comment

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

nice catch, thank you :)

@bmbouter
Copy link
Member

flake8 and tests look good. I left some comments. Please make some edits and ping me for re-review.

@pulpbot
Copy link
Member

pulpbot commented Feb 10, 2015

Refer to this link for build results (access rights to CI server needed):
https://pulp-jenkins.rhev-ci-vms.eng.rdu2.redhat.com//job/unittest-pulp-pr/126/
Test PASSed.

redirect_response = util.generate_redirect_response(response, href)
self.assertEqual(redirect_response.status_code, 201)
self.assertEqual(redirect_response.reason_phrase, 'CREATED')
mock_iri_to_uri.assert_called_once_with(href)
Copy link
Member

Choose a reason for hiding this comment

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

Try adding an assert statement to verify that the Location header is set to the return value of mock_iri_to_uri. From my own debugging I think the header is stored at redirect_response._headers['location']. I recommend letting mock auto-create the return_value which you can access with mock_iri_to_uri.return_value.

@bmbouter
Copy link
Member

@ipanova if you can add that assert statement and the tests pass on all platforms then LGTM.

@pulpbot
Copy link
Member

pulpbot commented Feb 10, 2015

Refer to this link for build results (access rights to CI server needed):
https://pulp-jenkins.rhev-ci-vms.eng.rdu2.redhat.com//job/unittest-pulp-pr/127/
Test PASSed.

@bowlofeggs
Copy link
Contributor

On 02/10/2015 08:04 AM, bmbouter wrote:

I expected the branch name to be '149' but instead it is 'task149'. All
tasks, issues, stories, etc in Redmine share the same numbering sequence
so '149' as the branch name specifies some clearly. This does not need
to be adjusted for this PR, just something I observed.

I don't think we need to have a policy about what branch names are used.
For one, the branch name resides only in the developer's fork of Pulp.
Secondly, onethe commit is merged the branch name is not part of the
repository history.

As long as we format our commit messages well, I think the developer can
use whatever branch names they like.

@bmbouter
Copy link
Member

@rbarlow I agree with you, but the docs document that we do assert a branch name convention. Should we adjust the docs?

@bmbouter
Copy link
Member

@ipanova LGTM, great job in resolving this.

@ipanova ipanova merged commit 129159d into pulp:master Feb 10, 2015
@bowlofeggs
Copy link
Contributor

On 02/10/2015 10:13 AM, bmbouter wrote:

@rbarlow https://github.com/rbarlow I agree with you, but the docs
document
http://pulp.readthedocs.org/en/latest/dev-guide/contributing/branching.html#bug-fix-branches
that we do assert a branch name convention. Should we adjust the docs?

Yes, I also commented on the pull request that created that doc saying I
disagreed with it then. There really is no reason to have such a policy.
It's needlessly strict.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants