diff options
author | Carl Baldwin <carl@ecbaldwin.net> | 2018-10-29 20:01:39 +0000 |
---|---|---|
committer | Carl Baldwin <carl@ecbaldwin.net> | 2018-10-29 20:10:19 +0000 |
commit | 8bccb4278a1c6cb291a9635a4b2252372f074b7e (patch) | |
tree | d1f9d1061a1db670fea7af527e10add4a2b09e59 /test/scenario_test/evpn_test.py | |
parent | c8694bc8a7dccd663689f8d134b89fe3a1f37d70 (diff) |
Use assertEqual in python tests
In trying to run the local tests, I found that changing these
assertTrue calls to assertEqual helped me out. With this, a failure
shows the actual and expected values rather than just saying "True is
not False" which is less helpful.
Diffstat (limited to 'test/scenario_test/evpn_test.py')
-rw-r--r-- | test/scenario_test/evpn_test.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/scenario_test/evpn_test.py b/test/scenario_test/evpn_test.py index b3d290bc..7e227b05 100644 --- a/test/scenario_test/evpn_test.py +++ b/test/scenario_test/evpn_test.py @@ -83,11 +83,11 @@ class GoBGPTestBase(unittest.TestCase): '-a evpn macadv 11:22:33:44:55:66 10.0.0.1 esi AS 1 1 1 etag 1000 label 1000 ' 'rd 10:10 rt 10:10') grib = self.g1.get_global_rib(rf='evpn') - self.assertTrue(len(grib) == 1) + self.assertEqual(len(grib), 1) dst = grib[0] - self.assertTrue(len(dst['paths']) == 1) + self.assertEqual(len(dst['paths']), 1) path = dst['paths'][0] - self.assertTrue(path['nexthop'] == '0.0.0.0') + self.assertEqual(path['nexthop'], '0.0.0.0') interval = 1 timeout = int(30 / interval) @@ -101,9 +101,9 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(interval) continue - self.assertTrue(len(grib) == 1) + self.assertEqual(len(grib), 1) dst = grib[0] - self.assertTrue(len(dst['paths']) == 1) + self.assertEqual(len(dst['paths']), 1) path = dst['paths'][0] n_addrs = [i[1].split('/')[0] for i in self.g1.ip_addrs] self.assertTrue(path['nexthop'] in n_addrs) @@ -117,13 +117,13 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(3) grib = self.g1.get_global_rib(rf='evpn') - self.assertTrue(len(grib) == 1) + self.assertEqual(len(grib), 1) dst = grib[0] - self.assertTrue(len(dst['paths']) == 1) + self.assertEqual(len(dst['paths']), 1) path = dst['paths'][0] n_addrs = [i[1].split('/')[0] for i in self.g2.ip_addrs] self.assertTrue(path['nexthop'] in n_addrs) - self.assertTrue(get_mac_mobility_sequence(path['attrs']) == 0) + self.assertEqual(get_mac_mobility_sequence(path['attrs']), 0) def test_04_check_mac_mobility_again(self): self.g1.local('gobgp global rib add ' @@ -133,13 +133,13 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(3) grib = self.g2.get_global_rib(rf='evpn') - self.assertTrue(len(grib) == 1) + self.assertEqual(len(grib), 1) dst = grib[0] - self.assertTrue(len(dst['paths']) == 1) + self.assertEqual(len(dst['paths']), 1) path = dst['paths'][0] n_addrs = [i[1].split('/')[0] for i in self.g1.ip_addrs] self.assertTrue(path['nexthop'] in n_addrs) - self.assertTrue(get_mac_mobility_sequence(path['attrs']) == 1) + self.assertEqual(get_mac_mobility_sequence(path['attrs']), 1) if __name__ == '__main__': |