diff options
| author | Andrey Volkov <avolkov@mirantis.com> | 2016-08-01 17:38:14 +0300 |
|---|---|---|
| committer | Andrey Volkov <avolkov@mirantis.com> | 2016-08-03 18:37:55 +0300 |
| commit | 6bbcedb0001df2312cbf39ba8090e780f9e0c884 (patch) | |
| tree | 4ab3f2b2e71255600cbefa47306a88a1c537fb8d /novaclient/tests/unit/test_utils.py | |
| parent | 48da89e2a297e44125cb88aa284cf99bf87c2b1f (diff) | |
| download | python-novaclient-6bbcedb0001df2312cbf39ba8090e780f9e0c884.tar.gz | |
Add support for microversion 2.33
This change allows novaclient to get several hypervisors
with the help of new optional parameters 'limit' and 'marker'
which were added to hipervisor-list command.
Change-Id: Ib723fb1dc1cd57b6f796bb93e0dd8ddf2da4b2a0
Diffstat (limited to 'novaclient/tests/unit/test_utils.py')
| -rw-r--r-- | novaclient/tests/unit/test_utils.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/novaclient/tests/unit/test_utils.py b/novaclient/tests/unit/test_utils.py index f3d88c21..64a947ea 100644 --- a/novaclient/tests/unit/test_utils.py +++ b/novaclient/tests/unit/test_utils.py @@ -16,6 +16,7 @@ import sys import mock from oslo_utils import encodeutils import six +from six.moves.urllib import parse from novaclient import base from novaclient import exceptions @@ -437,3 +438,22 @@ class RecordTimeTestCase(test_utils.TestCase): with utils.record_time(times, False, 'x'): pass self.assertEqual(0, len(times)) + + +class PrepareQueryStringTestCase(test_utils.TestCase): + def test_convert_dict_to_string(self): + ustr = b'?\xd0\xbf=1&\xd1\x80=2' + if six.PY3: + # in py3 real unicode symbols will be urlencoded + ustr = ustr.decode('utf8') + cases = ( + ({}, ''), + ({'2': 2, '10': 1}, '?10=1&2=2'), + ({'abc': 1, 'abc1': 2}, '?abc=1&abc1=2'), + ({b'\xd0\xbf': 1, b'\xd1\x80': 2}, ustr), + ({(1, 2): '1', (3, 4): '2'}, '?(1, 2)=1&(3, 4)=2') + ) + for case in cases: + self.assertEqual( + case[1], + parse.unquote_plus(utils.prepare_query_string(case[0]))) |
