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

Unquote response location in assertRedirect #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dannymidnight
Copy link

By default Flask url encodes query params which makes testing the location of a redirect slightly awkward.

eg. self.assertRedirects(res, '/login?next=/somewhere/') currently fails with
'http://localhost/?next=%2Fsomewhere%2F' != 'http://localhost/?next=/somewhere/'

This fixes the problem by unquoting the response location before asserting equality.

By default Flask url encodes query params which makes testing the
location of a redirect slightly awkward.

This fixes the problem by unquoting the url making for simpler assertions.

eg. `self.assertRedirects(res, '/login?next=/account')`
@jcass77
Copy link
Contributor

jcass77 commented Oct 13, 2016

I guess this won't be merged as it is not Python 3 compatible (see failed CI build)?

@jcomo
Copy link
Collaborator

jcomo commented Oct 14, 2016

The current state isn't python 3 compatible, but I also believe this should be kept as is by design. The query string parameter should be url encoded and the assertion should reflect that

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

Successfully merging this pull request may close these issues.

3 participants