Fix the ordering of assertEqual arguments
This keeps testtools happy, since it expects the argument ordering to be (expected, actual). Change-Id: I95b41ad7645700ce23b46c7a5700e79008ed08be Closes-bug: #1277104
This commit is contained in:
parent
8a877b2752
commit
1511c86933
@ -117,7 +117,7 @@ class TestClient(testtools.TestCase):
|
||||
|
||||
headers = {"test": u'ni\xf1o'}
|
||||
resp, body = self.client.get('/v1/images/detail', headers=headers)
|
||||
self.assertEqual(resp, fake)
|
||||
self.assertEqual(fake, resp)
|
||||
|
||||
def test_headers_encoding(self):
|
||||
value = u'ni\xf1o'
|
||||
@ -142,7 +142,7 @@ class TestClient(testtools.TestCase):
|
||||
self.mock.ReplayAll()
|
||||
|
||||
resp, body = self.client.get('/v1/images/detail', headers=headers)
|
||||
self.assertEqual(resp, fake)
|
||||
self.assertEqual(fake, resp)
|
||||
|
||||
def test_parse_endpoint(self):
|
||||
endpoint = 'http://example.com:9292'
|
||||
@ -175,7 +175,7 @@ class TestClient(testtools.TestCase):
|
||||
headers = {"test": u'chunked_request'}
|
||||
resp, body = self.client.post('/v1/images/',
|
||||
headers=headers, data=data)
|
||||
self.assertEqual(resp, fake)
|
||||
self.assertEqual(fake, resp)
|
||||
|
||||
def test_http_json(self):
|
||||
data = {"test": "json_request"}
|
||||
@ -213,7 +213,7 @@ class TestClient(testtools.TestCase):
|
||||
resp, body = self.client.post('/v1/images/',
|
||||
headers=headers,
|
||||
data=data)
|
||||
self.assertEqual(resp, fake)
|
||||
self.assertEqual(fake, resp)
|
||||
|
||||
def test_http_chunked_response(self):
|
||||
headers = {"Content-Type": "application/octet-stream"}
|
||||
|
@ -116,8 +116,8 @@ class ShellTest(utils.TestCase):
|
||||
shell(args)
|
||||
assert mock_versioned_client.called
|
||||
((api_version, args), kwargs) = mock_versioned_client.call_args
|
||||
self.assertEqual(args.os_cert, 'mycert')
|
||||
self.assertEqual(args.os_key, 'mykey')
|
||||
self.assertEqual('mycert', args.os_cert)
|
||||
self.assertEqual('mykey', args.os_key)
|
||||
|
||||
# make sure we get the same thing with --cert-file and --key-file
|
||||
args = '--cert-file mycertfile --key-file mykeyfile image-list'
|
||||
@ -125,8 +125,8 @@ class ShellTest(utils.TestCase):
|
||||
glance_shell.main(args.split())
|
||||
assert mock_versioned_client.called
|
||||
((api_version, args), kwargs) = mock_versioned_client.call_args
|
||||
self.assertEqual(args.os_cert, 'mycertfile')
|
||||
self.assertEqual(args.os_key, 'mykeyfile')
|
||||
self.assertEqual('mycertfile', args.os_cert)
|
||||
self.assertEqual('mykeyfile', args.os_key)
|
||||
|
||||
@mock.patch('glanceclient.v1.client.Client')
|
||||
def test_no_auth_with_token_and_image_url_with_v1(self, v1_client):
|
||||
@ -138,8 +138,8 @@ class ShellTest(utils.TestCase):
|
||||
glance_shell.main(args.split())
|
||||
assert v1_client.called
|
||||
(args, kwargs) = v1_client.call_args
|
||||
self.assertEqual(kwargs['token'], 'mytoken')
|
||||
self.assertEqual(args[0], 'https://image:1234/v1')
|
||||
self.assertEqual('mytoken', kwargs['token'])
|
||||
self.assertEqual('https://image:1234/v1', args[0])
|
||||
|
||||
@mock.patch.object(openstack_shell.OpenStackImagesShell, '_cache_schemas')
|
||||
def test_no_auth_with_token_and_image_url_with_v2(self,
|
||||
@ -153,8 +153,8 @@ class ShellTest(utils.TestCase):
|
||||
glance_shell = openstack_shell.OpenStackImagesShell()
|
||||
glance_shell.main(args.split())
|
||||
((args), kwargs) = v2_client.call_args
|
||||
self.assertEqual(args[0], 'https://image:1234/v2')
|
||||
self.assertEqual(kwargs['token'], 'mytoken')
|
||||
self.assertEqual('https://image:1234/v2', args[0])
|
||||
self.assertEqual('mytoken', kwargs['token'])
|
||||
|
||||
def _assert_auth_plugin_args(self, mock_auth_plugin):
|
||||
# make sure our auth plugin is invoked with the correct args
|
||||
|
@ -510,14 +510,14 @@ class TestNamespaceController(testtools.TestCase):
|
||||
def test_list_namespaces(self):
|
||||
namespaces = list(self.controller.list())
|
||||
|
||||
self.assertEqual(len(namespaces), 2)
|
||||
self.assertEqual(2, len(namespaces))
|
||||
self.assertEqual(NAMESPACE1, namespaces[0]['namespace'])
|
||||
self.assertEqual(NAMESPACE2, namespaces[1]['namespace'])
|
||||
|
||||
def test_list_namespaces_paginate(self):
|
||||
namespaces = list(self.controller.list(page_size=1))
|
||||
|
||||
self.assertEqual(len(namespaces), 2)
|
||||
self.assertEqual(2, len(namespaces))
|
||||
self.assertEqual(NAMESPACE7, namespaces[0]['namespace'])
|
||||
self.assertEqual(NAMESPACE8, namespaces[1]['namespace'])
|
||||
|
||||
@ -528,7 +528,7 @@ class TestNamespaceController(testtools.TestCase):
|
||||
}
|
||||
))
|
||||
|
||||
self.assertEqual(len(namespaces), 1)
|
||||
self.assertEqual(1, len(namespaces))
|
||||
self.assertEqual(NAMESPACE3, namespaces[0]['namespace'])
|
||||
|
||||
def test_list_namespaces_with_multiple_resource_types_filter(self):
|
||||
@ -538,7 +538,7 @@ class TestNamespaceController(testtools.TestCase):
|
||||
}
|
||||
))
|
||||
|
||||
self.assertEqual(len(namespaces), 1)
|
||||
self.assertEqual(1, len(namespaces))
|
||||
self.assertEqual(NAMESPACE4, namespaces[0]['namespace'])
|
||||
|
||||
def test_list_namespaces_with_visibility_filter(self):
|
||||
@ -548,7 +548,7 @@ class TestNamespaceController(testtools.TestCase):
|
||||
}
|
||||
))
|
||||
|
||||
self.assertEqual(len(namespaces), 1)
|
||||
self.assertEqual(1, len(namespaces))
|
||||
self.assertEqual(NAMESPACE5, namespaces[0]['namespace'])
|
||||
|
||||
def test_get_namespace(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user