diff options
author | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-03-06 15:09:16 +0100 |
---|---|---|
committer | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-03-06 15:39:00 +0100 |
commit | dea62e1593aa1facf49235e413400fa6f864e5d6 (patch) | |
tree | 2cde87807441fd57159c26fb022267f6ee8ebdc6 | |
parent | aa30e4642a5e71b6149dfc29821d4d85da410cc9 (diff) | |
download | python-heatclient-dea62e1593aa1facf49235e413400fa6f864e5d6.tar.gz |
Python3: fix test_stack_list_with_args()
The expected_url in test_stack_list_with_args() does not always match the URL
actually used in the code. This patch fixes this issue by:
- using urlutils.urlencode() in both the code and the tests, so that changes in
the urlencode() implementation do not affect the tests;
- setting the PYTHONHASHSEED environment variable to 0 when running the tests,
so that randomisation is disabled and urlutils.urlencode() has predictable
results.
Change-Id: I5b50bad98f5c237cdc12e4ab75f21917ca0ef30d
-rw-r--r-- | heatclient/tests/test_shell.py | 8 | ||||
-rw-r--r-- | tox.ini | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/heatclient/tests/test_shell.py b/heatclient/tests/test_shell.py index cd33c1b..6acdb64 100644 --- a/heatclient/tests/test_shell.py +++ b/heatclient/tests/test_shell.py @@ -392,9 +392,11 @@ class ShellTestUserPass(ShellBase): def test_stack_list_with_args(self): self._script_keystone_client() - expected_url = ('/stacks?' - 'status=COMPLETE&status=FAILED' - '&marker=fake_id&limit=2') + expected_url = '/stacks?%s' % urlutils.urlencode({ + 'limit': 2, + 'status': ['COMPLETE', 'FAILED'], + 'marker': 'fake_id', + }, True) fakes.script_heat_list(expected_url) self.m.ReplayAll() @@ -4,7 +4,10 @@ minversion = 1.6 skipsdist = True [testenv] +# Set PYTHONHASHSEED to 0 so that randomisation is disabled and +# urlutils.urlencode() has predictable results. setenv = VIRTUAL_ENV={envdir} + PYTHONHASHSEED=0 usedevelop = True install_command = pip install -U {opts} {packages} deps = -r{toxinidir}/requirements.txt |