From e6c6710283d5d2d778e579eb765c021d23a10be6 Mon Sep 17 00:00:00 2001 From: Vu Cong Tuan Date: Mon, 12 Jun 2017 16:13:13 +0700 Subject: [PATCH] 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 --- mistral_tempest_tests/tests/api/v2/test_actions.py | 8 ++++---- mistral_tempest_tests/tests/api/v2/test_cron_triggers.py | 2 +- mistral_tempest_tests/tests/api/v2/test_workbooks.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mistral_tempest_tests/tests/api/v2/test_actions.py b/mistral_tempest_tests/tests/api/v2/test_actions.py index 48ea4adee..e85a1a2a8 100644 --- a/mistral_tempest_tests/tests/api/v2/test_actions.py +++ b/mistral_tempest_tests/tests/api/v2/test_actions.py @@ -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') diff --git a/mistral_tempest_tests/tests/api/v2/test_cron_triggers.py b/mistral_tempest_tests/tests/api/v2/test_cron_triggers.py index acff08fb2..817c02ef4 100644 --- a/mistral_tempest_tests/tests/api/v2/test_cron_triggers.py +++ b/mistral_tempest_tests/tests/api/v2/test_cron_triggers.py @@ -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') diff --git a/mistral_tempest_tests/tests/api/v2/test_workbooks.py b/mistral_tempest_tests/tests/api/v2/test_workbooks.py index 87f6756ef..1caa728d2 100644 --- a/mistral_tempest_tests/tests/api/v2/test_workbooks.py +++ b/mistral_tempest_tests/tests/api/v2/test_workbooks.py @@ -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')