summaryrefslogtreecommitdiffstats
path: root/os_net_config
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-22 16:44:00 +0000
committerGerrit Code Review <review@openstack.org>2016-03-22 16:44:00 +0000
commit5d8bb4c6a1baee3f9e677f25086eadebef167d9e (patch)
tree6da093495c9626984bb7a3752b9d587806e91791 /os_net_config
parentef02752ebf86e5d8edc681426dc246d2d98732ea (diff)
parente87fac0224b8f61ea8df4b219d1c4a5f76ee1915 (diff)
Merge "Use assertTrue/False instead of assertEqual(T/F)"
Diffstat (limited to 'os_net_config')
-rw-r--r--os_net_config/tests/test_objects.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/os_net_config/tests/test_objects.py b/os_net_config/tests/test_objects.py
index 83f9221..b49c393 100644
--- a/os_net_config/tests/test_objects.py
+++ b/os_net_config/tests/test_objects.py
@@ -29,7 +29,7 @@ class TestRoute(base.TestCase):
route = objects.Route.from_json(json.loads(data))
self.assertEqual("172.19.0.1", route.next_hop)
self.assertEqual("172.19.0.0/24", route.ip_netmask)
- self.assertEqual(False, route.default)
+ self.assertFalse(route.default)
def test_from_json_default_route(self):
data = '{"next_hop": "172.19.0.1", "ip_netmask": "172.19.0.0/24", ' \
@@ -37,14 +37,14 @@ class TestRoute(base.TestCase):
route = objects.Route.from_json(json.loads(data))
self.assertEqual("172.19.0.1", route.next_hop)
self.assertEqual("172.19.0.0/24", route.ip_netmask)
- self.assertEqual(True, route.default)
+ self.assertTrue(route.default)
data = '{"next_hop": "172.19.0.1", "ip_netmask": "172.19.0.0/24", ' \
'"default": "true"}'
route = objects.Route.from_json(json.loads(data))
self.assertEqual("172.19.0.1", route.next_hop)
self.assertEqual("172.19.0.0/24", route.ip_netmask)
- self.assertEqual(True, route.default)
+ self.assertTrue(route.default)
class TestAddress(base.TestCase):
@@ -92,7 +92,7 @@ class TestInterface(base.TestCase):
data = '{"type": "interface", "name": "em1", "use_dhcp": true}'
interface = objects.object_from_json(json.loads(data))
self.assertEqual("em1", interface.name)
- self.assertEqual(True, interface.use_dhcp)
+ self.assertTrue(interface.use_dhcp)
def test_from_json_defroute(self):
data = '{"type": "interface", "name": "em1", "use_dhcp": true}'
@@ -105,8 +105,8 @@ class TestInterface(base.TestCase):
}
"""
interface2 = objects.object_from_json(json.loads(data))
- self.assertEqual(True, interface1.defroute)
- self.assertEqual(False, interface2.defroute)
+ self.assertTrue(interface1.defroute)
+ self.assertFalse(interface2.defroute)
def test_from_json_dhclient_args(self):
data = """{
@@ -138,7 +138,7 @@ class TestInterface(base.TestCase):
data = '{"type": "interface", "name": "nic1", "use_dhcp": true}'
interface = objects.object_from_json(json.loads(data))
self.assertEqual("em3", interface.name)
- self.assertEqual(True, interface.use_dhcp)
+ self.assertTrue(interface.use_dhcp)
def test_from_json_with_addresses(self):
data = """{
@@ -157,8 +157,8 @@ class TestInterface(base.TestCase):
"""
interface = objects.object_from_json(json.loads(data))
self.assertEqual("em1", interface.name)
- self.assertEqual(False, interface.use_dhcp)
- self.assertEqual(False, interface.use_dhcpv6)
+ self.assertFalse(interface.use_dhcp)
+ self.assertFalse(interface.use_dhcpv6)
self.assertEqual(1501, interface.mtu)
address1 = interface.v4_addresses()[0]
self.assertEqual("192.0.2.1", address1.ip)
@@ -176,7 +176,7 @@ class TestVlan(base.TestCase):
vlan = objects.object_from_json(json.loads(data))
self.assertEqual("em1", vlan.device)
self.assertEqual(16, vlan.vlan_id)
- self.assertEqual(True, vlan.use_dhcp)
+ self.assertTrue(vlan.use_dhcp)
def test_from_json_dhcp_nic1(self):
def dummy_numbered_nics(nic_mapping=None):
@@ -188,7 +188,7 @@ class TestVlan(base.TestCase):
vlan = objects.object_from_json(json.loads(data))
self.assertEqual("em4", vlan.device)
self.assertEqual(16, vlan.vlan_id)
- self.assertEqual(True, vlan.use_dhcp)
+ self.assertTrue(vlan.use_dhcp)
class TestBridge(base.TestCase):
@@ -206,10 +206,10 @@ class TestBridge(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("br-foo", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
- self.assertEqual(True, interface1.ovs_port)
+ self.assertTrue(interface1.ovs_port)
self.assertEqual("br-foo", interface1.bridge_name)
def test_from_json_dhcp_with_nic1(self):
@@ -229,10 +229,10 @@ class TestBridge(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("br-foo", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em5", interface1.name)
- self.assertEqual(True, interface1.ovs_port)
+ self.assertTrue(interface1.ovs_port)
self.assertEqual("br-foo", interface1.bridge_name)
def test_from_json_primary_interface(self):
@@ -254,16 +254,16 @@ class TestBridge(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("br-foo", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
self.assertEqual("em1", bridge.primary_interface_name)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
- self.assertEqual(True, interface1.ovs_port)
- self.assertEqual(True, interface1.primary)
+ self.assertTrue(interface1.ovs_port)
+ self.assertTrue(interface1.primary)
self.assertEqual("br-foo", interface1.bridge_name)
interface2 = bridge.members[1]
self.assertEqual("em2", interface2.name)
- self.assertEqual(True, interface2.ovs_port)
+ self.assertTrue(interface2.ovs_port)
self.assertEqual("br-foo", interface2.bridge_name)
@@ -282,10 +282,10 @@ class TestLinuxBridge(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("br-foo", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
- self.assertEqual(False, interface1.ovs_port)
+ self.assertFalse(interface1.ovs_port)
self.assertEqual("br-foo", interface1.linux_bridge_name)
def test_from_json_dhcp_with_nic1(self):
@@ -305,10 +305,10 @@ class TestLinuxBridge(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("br-foo", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em5", interface1.name)
- self.assertEqual(False, interface1.ovs_port)
+ self.assertFalse(interface1.ovs_port)
self.assertEqual("br-foo", interface1.linux_bridge_name)
def test_from_json_primary_interface(self):
@@ -330,16 +330,16 @@ class TestLinuxBridge(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("br-foo", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
self.assertEqual("em1", bridge.primary_interface_name)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
- self.assertEqual(False, interface1.ovs_port)
- self.assertEqual(True, interface1.primary)
+ self.assertFalse(interface1.ovs_port)
+ self.assertTrue(interface1.primary)
self.assertEqual("br-foo", interface1.linux_bridge_name)
interface2 = bridge.members[1]
self.assertEqual("em2", interface2.name)
- self.assertEqual(False, interface2.ovs_port)
+ self.assertFalse(interface2.ovs_port)
self.assertEqual("br-foo", interface2.linux_bridge_name)
@@ -419,7 +419,7 @@ class TestBond(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("bond1", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
interface2 = bridge.members[1]
@@ -449,7 +449,7 @@ class TestBond(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("bond1", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
interface2 = bridge.members[1]
@@ -477,7 +477,7 @@ class TestLinuxBond(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("bond1", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
interface2 = bridge.members[1]
@@ -507,7 +507,7 @@ class TestLinuxBond(base.TestCase):
"""
bridge = objects.object_from_json(json.loads(data))
self.assertEqual("bond1", bridge.name)
- self.assertEqual(True, bridge.use_dhcp)
+ self.assertTrue(bridge.use_dhcp)
interface1 = bridge.members[0]
self.assertEqual("em1", interface1.name)
interface2 = bridge.members[1]