Replace assertTrue(isinstance()) by optimal assert
assertTrue(isinstance(A, B)) or assertEqual(type(A), B) in tests should be replaced by assertIsInstance(A, B) provided by testtools. Closes-bug: #1268480 Change-Id: Ia43c944c56e66631c758cc5146150c2b5abb12ed
This commit is contained in:
parent
cc6e3bb960
commit
097efaba32
@ -27,7 +27,7 @@ class TestCategories(base.TestObjectCreation):
|
||||
resp, body = self.client.list_categories()
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertTrue(isinstance(body['categories'], list))
|
||||
self.assertIsInstance(body['categories'], list)
|
||||
|
||||
@tag('all', 'coverage')
|
||||
@attr(type='smoke')
|
||||
|
@ -65,7 +65,7 @@ class TestRepositorySanity(TestCaseRepository):
|
||||
resp, body = self.client.get_list_packages()
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertTrue(isinstance(body['packages'], list))
|
||||
self.assertIsInstance(body['packages'], list)
|
||||
|
||||
@tag('all', 'coverage')
|
||||
@attr(type='smoke')
|
||||
@ -73,7 +73,7 @@ class TestRepositorySanity(TestCaseRepository):
|
||||
resp, body = self.client.list_categories()
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertTrue(isinstance(body['categories'], list))
|
||||
self.assertIsInstance(body['categories'], list)
|
||||
|
||||
@tag('all', 'coverage')
|
||||
@attr(type='smoke')
|
||||
@ -389,4 +389,4 @@ class TestRepository(TestCaseRepository):
|
||||
resp, body = self.client.get_logo(self.package['id'])
|
||||
|
||||
self.assertEqual(200, resp.status)
|
||||
self.assertTrue(isinstance(body, str))
|
||||
self.assertIsInstance(body, str)
|
||||
|
@ -32,7 +32,7 @@ class TestServices(base.TestCase):
|
||||
sess['id'])
|
||||
|
||||
self.assertEqual(resp.status, 200)
|
||||
self.assertTrue(isinstance(services_list, list))
|
||||
self.assertIsInstance(services_list, list)
|
||||
|
||||
@tag('all', 'coverage')
|
||||
@attr(type='negative')
|
||||
|
@ -39,8 +39,8 @@ class PluginLoaderTest(base.MuranoTestCase):
|
||||
test_obj.load_extension(ext, name_map)
|
||||
self.assertEqual(1, len(test_obj.packages))
|
||||
loaded_pkg = test_obj.packages.values()[0]
|
||||
self.assertTrue(isinstance(loaded_pkg,
|
||||
extensions_loader.PackageDefinition))
|
||||
self.assertIsInstance(loaded_pkg,
|
||||
extensions_loader.PackageDefinition)
|
||||
self.assertEqual('test.namespace.Test', loaded_pkg.classes.keys()[0])
|
||||
self.assertEqual({'test.namespace.Test': test_obj.packages.keys()},
|
||||
name_map)
|
||||
|
Loading…
Reference in New Issue
Block a user