Replace assertEqual([], items) with assertEmpty(items)

Since assertEmpty() function has already been implemented,
let's use this function instead of generic assertEqual() function.
This change makes the code and the error messages to be more readable.
Therefore it improves maintainability a little bit.

Change-Id: I953aea98b2aad21552bafcb673d7872334cc99a5
This commit is contained in:
Vu Cong Tuan 2017-06-12 16:13:13 +07:00
parent e6068377b0
commit 6999942b8d
3 changed files with 8 additions and 8 deletions

View File

@ -43,7 +43,7 @@ class ActionTestsV2(base.TestCase):
resp, body = self.client.get_list_obj('actions')
self.assertEqual(200, resp.status)
self.assertNotEqual([], body['actions'])
self.assertNotEmpty(body['actions'])
self.assertNotIn('next', body)
@test.attr(type='smoke')
@ -139,7 +139,7 @@ class ActionTestsV2(base.TestCase):
)
self.assertEqual(200, resp.status)
self.assertNotEqual([], body['actions'])
self.assertNotEmpty(body['actions'])
for act in body['actions']:
self.assertFalse(act['is_system'])
@ -155,7 +155,7 @@ class ActionTestsV2(base.TestCase):
)
self.assertEqual(200, resp.status)
self.assertNotEqual([], body['actions'])
self.assertNotEmpty(body['actions'])
for act in body['actions']:
self.assertTrue(act['is_system'])
@ -204,7 +204,7 @@ class ActionTestsV2(base.TestCase):
)
self.assertEqual(200, resp.status)
self.assertEqual([], body['actions'])
self.assertEmpty(body['actions'])
@test.attr(type='smoke')
@decorators.idempotent_id('7f598dba-f169-47ec-a487-f0ed31484aff')

View File

@ -48,7 +48,7 @@ class CronTriggerTestsV2(base.TestCase):
resp, body = self.client.get_list_obj('cron_triggers')
self.assertEqual(200, resp.status)
self.assertEqual([], body['cron_triggers'])
self.assertEmpty(body['cron_triggers'])
@test.attr(type='sanity')
@decorators.idempotent_id('fbc641fa-8704-45b3-b259-136eb956394c')

View File

@ -37,7 +37,7 @@ class WorkbookTestsV2(base.TestCase):
resp, body = self.client.get_list_obj('workbooks')
self.assertEqual(200, resp.status)
self.assertEqual([], body['workbooks'])
self.assertEmpty(body['workbooks'])
@test.attr(type='sanity')
@decorators.idempotent_id('1a078ca2-bcf9-4eb9-8ed5-e3545038aa76')
@ -55,7 +55,7 @@ class WorkbookTestsV2(base.TestCase):
self.client.workbooks.remove(name)
_, body = self.client.get_list_obj('workbooks')
self.assertEqual([], body['workbooks'])
self.assertEmpty(body['workbooks'])
@test.attr(type='sanity')
@decorators.idempotent_id('80f7d7a6-2821-4ab0-b090-ca45c98258ba')
@ -117,7 +117,7 @@ class WorkbookTestsV2(base.TestCase):
self.client.workbooks.remove(name)
_, body = self.client.get_list_obj('workbooks')
self.assertEqual([], body['workbooks'])
self.assertEmpty(body['workbooks'])
@test.attr(type='negative')
@decorators.idempotent_id('1cd6f6f7-b166-454e-96d2-bf1f95c23015')