From 36d8c29ca6e0b307067adf67e89cc51762c0c7e4 Mon Sep 17 00:00:00 2001 From: Van Hung Pham Date: Fri, 23 Jun 2017 11:44:10 +0700 Subject: [PATCH] Use assertTrue/False(A) instead of assertEqual(True/False, A) This patch replaces assertEqual(True/False, A) with assertTrue/False(A), which is more straightforward and easier to understand. Change-Id: I98be6e11243aa7a801155bc14e642977481e5749 --- blazar/tests/test_policy.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/blazar/tests/test_policy.py b/blazar/tests/test_policy.py index 680e7f89..d37f694a 100644 --- a/blazar/tests/test_policy.py +++ b/blazar/tests/test_policy.py @@ -40,10 +40,10 @@ class BlazarPolicyTestCase(tests.TestCase): target_wrong = {'user_id': self.context.user_id, 'project_id': 'bad_project'} action = "blazar:leases" - self.assertEqual(True, policy.enforce(self.context, action, - target_good)) - self.assertEqual(False, policy.enforce(self.context, action, - target_wrong, False)) + self.assertTrue(policy.enforce(self.context, action, + target_good)) + self.assertFalse(policy.enforce(self.context, action, + target_wrong, False)) def test_adminpolicy(self): target = {'user_id': self.context.user_id, @@ -59,8 +59,7 @@ class BlazarPolicyTestCase(tests.TestCase): self.assertRaises(exceptions.PolicyNotAuthorized, policy.enforce, self.context, action, target) elevated_context = self.context.elevated() - self.assertEqual(True, - policy.enforce(elevated_context, action, target)) + self.assertTrue(policy.enforce(elevated_context, action, target)) def test_authorize(self): @@ -76,8 +75,8 @@ class BlazarPolicyTestCase(tests.TestCase): def adminonly_method(self): return True - self.assertEqual(True, user_method(self)) - self.assertEqual(True, user_method_with_action(self)) + self.assertTrue(user_method(self)) + self.assertTrue(user_method_with_action(self)) try: adminonly_method(self) self.assertTrue(False)