Fixed several test failures on Python3

- Corrected places where `dict.keys()` was being treated as a list
- Corrected usage of `urllib.urlencode()`

Change-Id: I0a24b2f64fab6c905e20073ff7ebaa3c5ffe7c90
This commit is contained in:
Alex Gaynor 2013-09-23 17:55:24 -07:00
parent 7a041f903a
commit 991ab62ef1
2 changed files with 7 additions and 8 deletions

View File

@ -493,7 +493,7 @@ class FakeHTTPClient(base_client.HTTPClient):
assert list(body[action]) == ['type']
assert body[action]['type'] in ['HARD', 'SOFT']
elif action == 'rebuild':
keys = body[action].keys()
keys = list(body[action])
if 'adminPass' in keys:
keys.remove('adminPass')
assert 'imageRef' in keys
@ -573,11 +573,11 @@ class FakeHTTPClient(base_client.HTTPClient):
elif action == 'removeSecurityGroup':
assert list(body[action]) == ['name']
elif action == 'createBackup':
assert set(body[action].keys()) == set(['name',
'backup_type',
'rotation'])
assert set(body[action]) == set(['name',
'backup_type',
'rotation'])
elif action == 'evacuate':
keys = body[action].keys()
keys = list(body[action])
if 'adminPass' in keys:
keys.remove('adminPass')
assert set(keys) == set(['host', 'onSharedStorage'])

View File

@ -16,9 +16,8 @@
migration interface
"""
import urllib
from novaclient import base
from novaclient.openstack.common.py3kcompat import urlutils
from novaclient import utils
@ -45,7 +44,7 @@ class MigrationManager(base.ManagerWithFind):
if cell_name:
opts['cell_name'] = cell_name
query_string = "?%s" % urllib.urlencode(opts) if opts else ""
query_string = "?%s" % urlutils.urlencode(opts) if opts else ""
return self._list("/os-migrations%s" % query_string, "migrations")