summaryrefslogtreecommitdiffstats
path: root/test/test_dhcp6.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-24 22:19:12 -0800
committerOle Trøan <otroan@employees.org>2018-11-30 07:43:05 +0000
commit978aa643ca32ab220be940290039eb11e068bb73 (patch)
tree4573250d3c0fe7a814cdd55647f2e1d86ebf770e /test/test_dhcp6.py
parentfa76a76bf3388f09d55d0c83e7aea507c44f9619 (diff)
Tests: Fix traceback.
self.assertTrue(packet.haslayer(msg_type)) File "/usr/lib/python2.7/unittest/case.py", line 422, in assertTrue raise self.failureException(msg) AssertionError: 0 is not true * Scapy packet.haslayer() returns 1 or 0. Replace with assertEqual(packet.haslayer(), 1) to fix tracebacks. * Scapy has multiple layers called TCP/UDP Specify the module name to prevent namespace collisions. * Remove duplicate import. Change-Id: I600f9f330075cd40e1da50f8b2ceb24f645f2c20 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/test_dhcp6.py')
-rw-r--r--test/test_dhcp6.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_dhcp6.py b/test/test_dhcp6.py
index fe06f986bf5..6c203868673 100644
--- a/test/test_dhcp6.py
+++ b/test/test_dhcp6.py
@@ -61,8 +61,8 @@ class TestDHCPv6DataPlane(VppTestCase):
self.assertEqual(len(rx_list), 1)
packet = rx_list[0]
- self.assertTrue(packet.haslayer(IPv6))
- self.assertTrue(packet[IPv6].haslayer(DHCP6_Solicit))
+ self.assertEqual(packet.haslayer(IPv6), 1)
+ self.assertEqual(packet[IPv6].haslayer(DHCP6_Solicit), 1)
client_duid = packet[DHCP6OptClientId].duid
trid = packet[DHCP6_Solicit].trid
@@ -137,8 +137,8 @@ class TestDHCPv6DataPlane(VppTestCase):
self.assertEqual(len(rx_list), 1)
packet = rx_list[0]
- self.assertTrue(packet.haslayer(IPv6))
- self.assertTrue(packet[IPv6].haslayer(DHCP6_Solicit))
+ self.assertEqual(packet.haslayer(IPv6), 1)
+ self.assertEqual(packet[IPv6].haslayer(DHCP6_Solicit), 1)
client_duid = packet[DHCP6OptClientId].duid
trid = packet[DHCP6_Solicit].trid
@@ -256,7 +256,7 @@ class TestDHCPv6IANAControlPlane(VppTestCase):
def validate_packet(self, packet, msg_type, is_resend=False):
try:
- self.assertTrue(packet.haslayer(msg_type))
+ self.assertEqual(packet.haslayer(msg_type), 1)
client_duid = packet[DHCP6OptClientId].duid
if self.client_duid is None:
self.client_duid = client_duid
@@ -508,7 +508,7 @@ class TestDHCPv6PDControlPlane(VppTestCase):
def validate_packet(self, packet, msg_type, is_resend=False):
try:
- self.assertTrue(packet.haslayer(msg_type))
+ self.assertEqual(packet.haslayer(msg_type), 1)
client_duid = packet[DHCP6OptClientId].duid
if self.client_duid is None:
self.client_duid = client_duid