flask-testing icon indicating copy to clipboard operation
flask-testing copied to clipboard

Unquote response location in assertRedirect

Open dannymidnight opened this issue 11 years ago • 2 comments

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.

dannymidnight avatar Dec 05 '14 23:12 dannymidnight

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

jcass77 avatar Oct 13 '16 10:10 jcass77

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

jcomo avatar Oct 14 '16 07:10 jcomo