Fix invalid argument formatting in exception messages
This is to fix the invalid argument formatting in exception messages. Change-Id: I3ed91a4fd22b36815b5cefdd8c9b2fc2a7df4471
This commit is contained in:
parent
0bed84a6ba
commit
af53e4b4c2
@ -40,7 +40,7 @@ class FakeClient(object):
|
||||
|
||||
if body is not None:
|
||||
if self.client.callstack[pos][2] != body:
|
||||
raise AssertionError('%s != %s',
|
||||
raise AssertionError('%s != %s' %
|
||||
(self.client.callstack[pos][2], body))
|
||||
|
||||
def assert_called_anytime(self, method, url, body=None):
|
||||
|
@ -342,21 +342,21 @@ class FakeSessionClient(base_client.SessionClient):
|
||||
keys = list(body[action].keys()) if body[action] is not None else None
|
||||
if action == 'reboot':
|
||||
if keys != ['type']:
|
||||
raise AssertionError('Unexpection action keys for %s: %s',
|
||||
action, keys)
|
||||
raise AssertionError('Unexpection action keys for %s: %s' %
|
||||
(action, keys))
|
||||
if body[action]['type'] not in ['HARD', 'SOFT']:
|
||||
raise AssertionError('Unexpected reboot type %s',
|
||||
raise AssertionError('Unexpected reboot type %s' %
|
||||
body[action]['type'])
|
||||
elif action == 'rebuild':
|
||||
if 'adminPass' in keys:
|
||||
keys.remove('adminPass')
|
||||
if keys != ['imageRef']:
|
||||
raise AssertionError('Unexpection action keys for %s: %s',
|
||||
action, keys)
|
||||
raise AssertionError('Unexpection action keys for %s: %s' %
|
||||
(action, keys))
|
||||
_body = self.get_servers_1234()[1]
|
||||
elif action == 'confirmResize':
|
||||
if body[action] is not None:
|
||||
raise AssertionError('Unexpected data for confirmResize: %s',
|
||||
raise AssertionError('Unexpected data for confirmResize: %s' %
|
||||
body[action])
|
||||
# This one method returns a different response code
|
||||
return (204, None)
|
||||
@ -367,8 +367,8 @@ class FakeSessionClient(base_client.SessionClient):
|
||||
'lock', 'unlock',
|
||||
'forceDelete']:
|
||||
if body[action] is not None:
|
||||
raise AssertionError('Unexpected data for %s: %s',
|
||||
action, body[action])
|
||||
raise AssertionError('Unexpected data for %s: %s' %
|
||||
(action, body[action]))
|
||||
else:
|
||||
expected_keys = {
|
||||
'resize': {'flavorRef'},
|
||||
@ -386,8 +386,8 @@ class FakeSessionClient(base_client.SessionClient):
|
||||
|
||||
if action in expected_keys:
|
||||
if set(keys) != set(expected_keys[action]):
|
||||
raise AssertionError('Unexpection action keys for %s: %s',
|
||||
action, keys)
|
||||
raise AssertionError('Unexpection action keys for %s: %s' %
|
||||
(action, keys))
|
||||
else:
|
||||
raise AssertionError("Unexpected server action: %s" % action)
|
||||
|
||||
@ -410,8 +410,8 @@ class FakeSessionClient(base_client.SessionClient):
|
||||
]:
|
||||
keys = list(body[action].keys())
|
||||
if keys != ['address']:
|
||||
raise AssertionError('Unexpection action keys for %s: %s',
|
||||
action, keys)
|
||||
raise AssertionError('Unexpection action keys for %s: %s' %
|
||||
(action, keys))
|
||||
|
||||
return (resp, _body)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user