Replace assertEqual(True/False, expr) with assertTrue/assertFalse
In some cases, If the result of expr is a boolen value, we shoud use assertTrue/assertFalse to instead. Because it is clear and simple. Change-Id: I53b345fc3915a7b0e737e9dd4d58fe09c746d61c
This commit is contained in:
parent
b90c780d2b
commit
5bec3b7e3b
@ -112,8 +112,7 @@ class FlavorTests(base.TestCase):
|
||||
0,
|
||||
cmd_output["disk"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
self.assertFalse(
|
||||
cmd_output["os-flavor-access:is_public"],
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -199,8 +198,7 @@ class FlavorTests(base.TestCase):
|
||||
20,
|
||||
cmd_output["disk"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
self.assertFalse(
|
||||
cmd_output["os-flavor-access:is_public"],
|
||||
)
|
||||
self.assertEqual(
|
||||
|
@ -72,7 +72,7 @@ class ProjectTests(common.IdentityTests):
|
||||
self.assert_show_fields(items, fields)
|
||||
project = self.parse_show_as_object(raw_output)
|
||||
self.assertEqual(new_project_name, project['name'])
|
||||
self.assertEqual('False', project['enabled'])
|
||||
self.assertFalse(project['enabled'])
|
||||
self.assertEqual("k0='v0'", project['properties'])
|
||||
|
||||
def test_project_show(self):
|
||||
|
@ -42,10 +42,7 @@ class AddressScopeTests(common.NetworkTests):
|
||||
cmd_output['name'],
|
||||
)
|
||||
# Check the default values
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output['shared'],
|
||||
)
|
||||
self.assertFalse(cmd_output['shared'])
|
||||
|
||||
name2 = uuid.uuid4().hex
|
||||
cmd_output = json.loads(self.openstack(
|
||||
@ -80,10 +77,7 @@ class AddressScopeTests(common.NetworkTests):
|
||||
4,
|
||||
cmd_output['ip_version'],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output['shared'],
|
||||
)
|
||||
self.assertTrue(cmd_output['shared'])
|
||||
|
||||
name2 = uuid.uuid4().hex
|
||||
cmd_output = json.loads(self.openstack(
|
||||
@ -101,10 +95,7 @@ class AddressScopeTests(common.NetworkTests):
|
||||
6,
|
||||
cmd_output['ip_version'],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output['shared'],
|
||||
)
|
||||
self.assertFalse(cmd_output['shared'])
|
||||
|
||||
# Test list
|
||||
cmd_output = json.loads(self.openstack(
|
||||
@ -149,10 +140,7 @@ class AddressScopeTests(common.NetworkTests):
|
||||
4,
|
||||
cmd_output['ip_version'],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output['shared'],
|
||||
)
|
||||
self.assertFalse(cmd_output['shared'])
|
||||
|
||||
raw_output = self.openstack(
|
||||
'address scope set ' +
|
||||
@ -174,7 +162,4 @@ class AddressScopeTests(common.NetworkTests):
|
||||
4,
|
||||
cmd_output['ip_version'],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output['shared'],
|
||||
)
|
||||
self.assertTrue(cmd_output['shared'])
|
||||
|
@ -70,8 +70,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
'1.2.4.0/28',
|
||||
cmd_output["cidr"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
self.assertTrue(
|
||||
cmd_output["share_address"],
|
||||
)
|
||||
|
||||
@ -124,8 +123,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
'UP',
|
||||
cmd_output["admin_state_up"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
self.assertFalse(
|
||||
cmd_output["shared"],
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -236,21 +234,14 @@ class NetworkTests(common.NetworkTagTests):
|
||||
'UP',
|
||||
cmd_output["admin_state_up"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["shared"],
|
||||
)
|
||||
self.assertFalse(cmd_output["shared"])
|
||||
self.assertEqual(
|
||||
'Internal',
|
||||
cmd_output["router:external"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["is_default"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["port_security_enabled"],
|
||||
self.assertFalse(cmd_output["is_default"])
|
||||
self.assertTrue(
|
||||
cmd_output["port_security_enabled"]
|
||||
)
|
||||
else:
|
||||
self.assertEqual(
|
||||
@ -278,27 +269,15 @@ class NetworkTests(common.NetworkTagTests):
|
||||
'DOWN',
|
||||
cmd_output["admin_state_up"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["shared"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["is_default"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["port_security_enabled"],
|
||||
)
|
||||
self.assertTrue(cmd_output["shared"])
|
||||
self.assertFalse(cmd_output["is_default"])
|
||||
self.assertTrue(cmd_output["port_security_enabled"])
|
||||
else:
|
||||
self.assertEqual(
|
||||
'4.5.6.0/28',
|
||||
cmd_output["cidr"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["share_address"],
|
||||
)
|
||||
self.assertTrue(cmd_output["share_address"])
|
||||
|
||||
# Test list
|
||||
cmd_output = json.loads(self.openstack(
|
||||
@ -422,22 +401,15 @@ class NetworkTests(common.NetworkTagTests):
|
||||
'UP',
|
||||
cmd_output["admin_state_up"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["shared"],
|
||||
)
|
||||
self.assertFalse(cmd_output["shared"])
|
||||
self.assertEqual(
|
||||
'Internal',
|
||||
cmd_output["router:external"],
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["is_default"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["port_security_enabled"],
|
||||
self.assertFalse(cmd_output["is_default"])
|
||||
self.assertTrue(
|
||||
cmd_output["port_security_enabled"]
|
||||
)
|
||||
|
||||
raw_output = self.openstack(
|
||||
@ -463,19 +435,12 @@ class NetworkTests(common.NetworkTagTests):
|
||||
'DOWN',
|
||||
cmd_output["admin_state_up"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["shared"],
|
||||
)
|
||||
self.assertTrue(cmd_output["shared"])
|
||||
self.assertEqual(
|
||||
'External',
|
||||
cmd_output["router:external"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["is_default"],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output["port_security_enabled"],
|
||||
self.assertFalse(cmd_output["is_default"])
|
||||
self.assertFalse(
|
||||
cmd_output["port_security_enabled"]
|
||||
)
|
||||
|
@ -87,10 +87,7 @@ class NetworkFlavorTests(common.NetworkTests):
|
||||
name1,
|
||||
cmd_output['name'],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output['enabled'],
|
||||
)
|
||||
self.assertTrue(cmd_output['enabled'])
|
||||
self.assertEqual(
|
||||
'testdescription',
|
||||
cmd_output['description'],
|
||||
@ -105,10 +102,7 @@ class NetworkFlavorTests(common.NetworkTests):
|
||||
name2,
|
||||
cmd_output['name'],
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
cmd_output['enabled'],
|
||||
)
|
||||
self.assertFalse(cmd_output['enabled'])
|
||||
self.assertEqual(
|
||||
'testdescription1',
|
||||
cmd_output['description'],
|
||||
|
@ -35,10 +35,7 @@ class NetworkFlavorProfileTests(common.NetworkTests):
|
||||
))
|
||||
ID = json_output.get('id')
|
||||
self.assertIsNotNone(ID)
|
||||
self.assertEqual(
|
||||
True,
|
||||
json_output.get('enabled'),
|
||||
)
|
||||
self.assertTrue(json_output.get('enabled'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
@ -61,10 +58,7 @@ class NetworkFlavorProfileTests(common.NetworkTests):
|
||||
))
|
||||
ID1 = json_output.get('id')
|
||||
self.assertIsNotNone(ID1)
|
||||
self.assertEqual(
|
||||
True,
|
||||
json_output.get('enabled'),
|
||||
)
|
||||
self.assertTrue(json_output.get('enabled'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
@ -82,10 +76,7 @@ class NetworkFlavorProfileTests(common.NetworkTests):
|
||||
))
|
||||
ID2 = json_output.get('id')
|
||||
self.assertIsNotNone(ID2)
|
||||
self.assertEqual(
|
||||
False,
|
||||
json_output.get('enabled'),
|
||||
)
|
||||
self.assertFalse(json_output.get('enabled'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
@ -120,10 +111,7 @@ class NetworkFlavorProfileTests(common.NetworkTests):
|
||||
))
|
||||
ID = json_output_1.get('id')
|
||||
self.assertIsNotNone(ID)
|
||||
self.assertEqual(
|
||||
True,
|
||||
json_output_1.get('enabled'),
|
||||
)
|
||||
self.assertTrue(json_output_1.get('enabled'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output_1.get('description'),
|
||||
@ -138,10 +126,7 @@ class NetworkFlavorProfileTests(common.NetworkTests):
|
||||
json_output = json.loads(self.openstack(
|
||||
'network flavor profile show -f json ' + ID
|
||||
))
|
||||
self.assertEqual(
|
||||
False,
|
||||
json_output.get('enabled'),
|
||||
)
|
||||
self.assertFalse(json_output.get('enabled'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
@ -171,10 +156,7 @@ class NetworkFlavorProfileTests(common.NetworkTests):
|
||||
ID,
|
||||
json_output["id"],
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
json_output["enabled"],
|
||||
)
|
||||
self.assertTrue(json_output["enabled"])
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output["description"],
|
||||
|
@ -48,10 +48,7 @@ class TestMeter(common.NetworkTests):
|
||||
json_output.get('name'),
|
||||
)
|
||||
# Check if default shared values
|
||||
self.assertEqual(
|
||||
False,
|
||||
json_output.get('shared'),
|
||||
)
|
||||
self.assertFalse(json_output.get('shared'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
@ -67,10 +64,7 @@ class TestMeter(common.NetworkTests):
|
||||
json_output_2.get('name'),
|
||||
)
|
||||
# Check if default shared values
|
||||
self.assertEqual(
|
||||
False,
|
||||
json_output_2.get('shared'),
|
||||
)
|
||||
self.assertFalse(json_output_2.get('shared'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output_2.get('description'),
|
||||
@ -99,10 +93,7 @@ class TestMeter(common.NetworkTests):
|
||||
'Test1',
|
||||
json_output.get('description'),
|
||||
)
|
||||
self.assertEqual(
|
||||
True,
|
||||
json_output.get('shared'),
|
||||
)
|
||||
self.assertTrue(json_output.get('shared'))
|
||||
|
||||
name2 = uuid.uuid4().hex
|
||||
json_output_2 = json.loads(self.openstack(
|
||||
@ -117,8 +108,7 @@ class TestMeter(common.NetworkTests):
|
||||
'Test2',
|
||||
json_output_2.get('description'),
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
self.assertFalse(
|
||||
json_output_2.get('shared'),
|
||||
)
|
||||
|
||||
@ -143,10 +133,7 @@ class TestMeter(common.NetworkTests):
|
||||
json_output = json.loads(self.openstack(
|
||||
'network meter show -f json ' + meter_id
|
||||
))
|
||||
self.assertEqual(
|
||||
False,
|
||||
json_output.get('shared'),
|
||||
)
|
||||
self.assertFalse(json_output.get('shared'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
@ -164,10 +151,7 @@ class TestMeter(common.NetworkTests):
|
||||
meter_id,
|
||||
json_output.get('id'),
|
||||
)
|
||||
self.assertEqual(
|
||||
False,
|
||||
json_output.get('shared'),
|
||||
)
|
||||
self.assertFalse(json_output.get('shared'))
|
||||
self.assertEqual(
|
||||
'fakedescription',
|
||||
json_output.get('description'),
|
||||
|
@ -247,10 +247,7 @@ class RouterTests(common.NetworkTagTests):
|
||||
'router show -f json ' +
|
||||
new_name
|
||||
))
|
||||
self.assertEqual(
|
||||
True,
|
||||
cmd_output["distributed"],
|
||||
)
|
||||
self.assertTrue(cmd_output["distributed"])
|
||||
self.assertIsNotNone(cmd_output["external_gateway_info"])
|
||||
|
||||
# Test unset
|
||||
|
Loading…
Reference in New Issue
Block a user