Merge "Fix argument order for assertEqual to (expected, observed)"
This commit is contained in:
commit
835747d40f
cinderclient/tests/unit
@ -193,7 +193,7 @@ class DeprecatedAuthPluginTest(utils.TestCase):
|
|||||||
auth_system="fakewithauthurl",
|
auth_system="fakewithauthurl",
|
||||||
auth_plugin=plugin)
|
auth_plugin=plugin)
|
||||||
cs.client.authenticate()
|
cs.client.authenticate()
|
||||||
self.assertEqual(cs.client.auth_url, "http://faked/v2.0")
|
self.assertEqual("http://faked/v2.0", cs.client.auth_url)
|
||||||
|
|
||||||
test_auth_call()
|
test_auth_call()
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ class AuthPluginTest(utils.TestCase):
|
|||||||
cs = client.Client("username", "password", "project_id",
|
cs = client.Client("username", "password", "project_id",
|
||||||
auth_system="fakewithauthurl",
|
auth_system="fakewithauthurl",
|
||||||
auth_plugin=plugin)
|
auth_plugin=plugin)
|
||||||
self.assertEqual(cs.client.auth_url, "http://faked/v2.0")
|
self.assertEqual("http://faked/v2.0", cs.client.auth_url)
|
||||||
|
|
||||||
@mock.patch.object(pkg_resources, "iter_entry_points")
|
@mock.patch.object(pkg_resources, "iter_entry_points")
|
||||||
def test_exception_if_no_authenticate(self, mock_iter_entry_points):
|
def test_exception_if_no_authenticate(self, mock_iter_entry_points):
|
||||||
|
@ -156,7 +156,7 @@ class ClientTest(utils.TestCase):
|
|||||||
resp, body = cl.get("/hi")
|
resp, body = cl.get("/hi")
|
||||||
|
|
||||||
test_get_call()
|
test_get_call()
|
||||||
self.assertEqual(self.requests, [])
|
self.assertEqual([], self.requests)
|
||||||
|
|
||||||
def test_retry_limit(self):
|
def test_retry_limit(self):
|
||||||
cl = get_authed_client(retries=1)
|
cl = get_authed_client(retries=1)
|
||||||
@ -277,4 +277,4 @@ class ClientTest(utils.TestCase):
|
|||||||
resp, body = cl.get("/hi")
|
resp, body = cl.get("/hi")
|
||||||
|
|
||||||
test_get_call()
|
test_get_call()
|
||||||
self.assertEqual(self.requests, [])
|
self.assertEqual([], self.requests)
|
||||||
|
@ -113,14 +113,14 @@ class ShellTest(utils.TestCase):
|
|||||||
self.register_keystone_auth_fixture(mocker, os_auth_url)
|
self.register_keystone_auth_fixture(mocker, os_auth_url)
|
||||||
v2_url, v3_url = _shell._discover_auth_versions(
|
v2_url, v3_url = _shell._discover_auth_versions(
|
||||||
None, auth_url=os_auth_url)
|
None, auth_url=os_auth_url)
|
||||||
self.assertEqual(v2_url, os_auth_url, "Expected v2 url")
|
self.assertEqual(os_auth_url, v2_url, "Expected v2 url")
|
||||||
self.assertIsNone(v3_url, "Expected no v3 url")
|
self.assertIsNone(v3_url, "Expected no v3 url")
|
||||||
|
|
||||||
os_auth_url = "https://DiscoveryNotSupported.discovery.com:35357/v3.0"
|
os_auth_url = "https://DiscoveryNotSupported.discovery.com:35357/v3.0"
|
||||||
self.register_keystone_auth_fixture(mocker, os_auth_url)
|
self.register_keystone_auth_fixture(mocker, os_auth_url)
|
||||||
v2_url, v3_url = _shell._discover_auth_versions(
|
v2_url, v3_url = _shell._discover_auth_versions(
|
||||||
None, auth_url=os_auth_url)
|
None, auth_url=os_auth_url)
|
||||||
self.assertEqual(v3_url, os_auth_url, "Expected v3 url")
|
self.assertEqual(os_auth_url, v3_url, "Expected v3 url")
|
||||||
self.assertIsNone(v2_url, "Expected no v2 url")
|
self.assertIsNone(v2_url, "Expected no v2 url")
|
||||||
|
|
||||||
@requests_mock.Mocker()
|
@requests_mock.Mocker()
|
||||||
|
@ -73,8 +73,8 @@ class FixturedTestCase(TestCase):
|
|||||||
self.data_fixture = self.useFixture(fix)
|
self.data_fixture = self.useFixture(fix)
|
||||||
|
|
||||||
def assert_called(self, method, path, body=None):
|
def assert_called(self, method, path, body=None):
|
||||||
self.assertEqual(self.requests.last_request.method, method)
|
self.assertEqual(method, self.requests.last_request.method)
|
||||||
self.assertEqual(self.requests.last_request.path_url, path)
|
self.assertEqual(path, self.requests.last_request.path_url)
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
req_data = self.requests.last_request.body
|
req_data = self.requests.last_request.body
|
||||||
@ -83,7 +83,7 @@ class FixturedTestCase(TestCase):
|
|||||||
if not isinstance(body, six.string_types):
|
if not isinstance(body, six.string_types):
|
||||||
# json load if the input body to match against is not a string
|
# json load if the input body to match against is not a string
|
||||||
req_data = json.loads(req_data)
|
req_data = json.loads(req_data)
|
||||||
self.assertEqual(req_data, body)
|
self.assertEqual(body, req_data)
|
||||||
|
|
||||||
|
|
||||||
class TestResponse(requests.Response):
|
class TestResponse(requests.Response):
|
||||||
|
@ -95,7 +95,7 @@ class ShellTest(utils.TestCase):
|
|||||||
'id': 1234, 'display_name': 'sample-volume',
|
'id': 1234, 'display_name': 'sample-volume',
|
||||||
'os-vol-tenant-attr:tenant_id': 'fake_tenant'})
|
'os-vol-tenant-attr:tenant_id': 'fake_tenant'})
|
||||||
shell_v1._translate_volume_keys([v])
|
shell_v1._translate_volume_keys([v])
|
||||||
self.assertEqual(v.tenant_id, 'fake_tenant')
|
self.assertEqual('fake_tenant', v.tenant_id)
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
self.run_command('list')
|
self.run_command('list')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user