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
This commit is contained in:
parent
f3a70837e2
commit
36d8c29ca6
|
@ -40,10 +40,10 @@ class BlazarPolicyTestCase(tests.TestCase):
|
||||||
target_wrong = {'user_id': self.context.user_id,
|
target_wrong = {'user_id': self.context.user_id,
|
||||||
'project_id': 'bad_project'}
|
'project_id': 'bad_project'}
|
||||||
action = "blazar:leases"
|
action = "blazar:leases"
|
||||||
self.assertEqual(True, policy.enforce(self.context, action,
|
self.assertTrue(policy.enforce(self.context, action,
|
||||||
target_good))
|
target_good))
|
||||||
self.assertEqual(False, policy.enforce(self.context, action,
|
self.assertFalse(policy.enforce(self.context, action,
|
||||||
target_wrong, False))
|
target_wrong, False))
|
||||||
|
|
||||||
def test_adminpolicy(self):
|
def test_adminpolicy(self):
|
||||||
target = {'user_id': self.context.user_id,
|
target = {'user_id': self.context.user_id,
|
||||||
|
@ -59,8 +59,7 @@ class BlazarPolicyTestCase(tests.TestCase):
|
||||||
self.assertRaises(exceptions.PolicyNotAuthorized, policy.enforce,
|
self.assertRaises(exceptions.PolicyNotAuthorized, policy.enforce,
|
||||||
self.context, action, target)
|
self.context, action, target)
|
||||||
elevated_context = self.context.elevated()
|
elevated_context = self.context.elevated()
|
||||||
self.assertEqual(True,
|
self.assertTrue(policy.enforce(elevated_context, action, target))
|
||||||
policy.enforce(elevated_context, action, target))
|
|
||||||
|
|
||||||
def test_authorize(self):
|
def test_authorize(self):
|
||||||
|
|
||||||
|
@ -76,8 +75,8 @@ class BlazarPolicyTestCase(tests.TestCase):
|
||||||
def adminonly_method(self):
|
def adminonly_method(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.assertEqual(True, user_method(self))
|
self.assertTrue(user_method(self))
|
||||||
self.assertEqual(True, user_method_with_action(self))
|
self.assertTrue(user_method_with_action(self))
|
||||||
try:
|
try:
|
||||||
adminonly_method(self)
|
adminonly_method(self)
|
||||||
self.assertTrue(False)
|
self.assertTrue(False)
|
||||||
|
|
Loading…
Reference in New Issue