Mercurial > kallithea
changeset 8042:43ee4d4d68f2
tests: refactor test_redirection_to_login_form_preserves_get_args to test more correctly
Preparing for py3.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 26 Dec 2019 16:13:27 +0100 |
parents | 5f3101d54c32 |
children | 7986422cacb3 |
files | kallithea/tests/functional/test_login.py |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/functional/test_login.py Thu Dec 26 15:14:55 2019 +0100 +++ b/kallithea/tests/functional/test_login.py Thu Dec 26 16:13:27 2019 +0100 @@ -160,12 +160,11 @@ # verify that get arguments are correctly passed along login redirection - @parametrize('args,args_encoded', [ - ({'foo':'one', 'bar':'two'}, (('foo', 'one'), ('bar', 'two'))), - ({'blue': u'blå'.encode('utf-8'), 'green':u'grøn'}, - (('blue', u'blå'.encode('utf-8')), ('green', u'grøn'.encode('utf-8')))), + @parametrize('args', [ + {'foo':'one', 'bar':'two'}, + {'blue': u'blå', 'green': u'grøn'}, ]) - def test_redirection_to_login_form_preserves_get_args(self, args, args_encoded): + def test_redirection_to_login_form_preserves_get_args(self, args): with fixture.anon_access(False): response = self.app.get(url(controller='summary', action='index', repo_name=HG_REPO, @@ -173,8 +172,7 @@ assert response.status == '302 Found' came_from = urlparse.parse_qs(urlparse.urlparse(response.location).query)['came_from'][0] came_from_qs = urlparse.parse_qsl(urlparse.urlparse(came_from).query) - for encoded in args_encoded: - assert encoded in came_from_qs + assert sorted(came_from_qs) == sorted((k, v.encode('utf-8')) for k, v in args.items()) @parametrize('args,args_encoded', [ ({'foo':'one', 'bar':'two'}, ('foo=one', 'bar=two')),