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/vrf_neighbor_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/vrf_neighbor_test.py')
-rw-r--r-- | test/scenario_test/vrf_neighbor_test.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/test/scenario_test/vrf_neighbor_test.py b/test/scenario_test/vrf_neighbor_test.py index f0c6de70..333b14f6 100644 --- a/test/scenario_test/vrf_neighbor_test.py +++ b/test/scenario_test/vrf_neighbor_test.py @@ -118,28 +118,28 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(1) dst = self.g2.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue([self.g4.asn, self.g1.asn] == path['aspath']) + self.assertEqual([self.g4.asn, self.g1.asn], path['aspath']) dst = self.g3.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 0) + self.assertEqual(len(dst), 0) dst = self.g4.get_global_rib(rf='vpnv4') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue([self.g1.asn] == path['aspath']) + self.assertEqual([self.g1.asn], path['aspath']) dst = self.g6.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue([self.g5.asn, self.g4.asn, self.g1.asn] == path['aspath']) + self.assertEqual([self.g5.asn, self.g4.asn, self.g1.asn], path['aspath']) dst = self.g7.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 0) + self.assertEqual(len(dst), 0) def test_03_inject_from_vrf_blue(self): self.g3.local('gobgp global rib add 10.0.0.0/24') @@ -147,25 +147,25 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(1) dst = self.g2.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue([self.g4.asn, self.g1.asn] == path['aspath']) + self.assertEqual([self.g4.asn, self.g1.asn], path['aspath']) dst = self.g4.get_global_rib(rf='vpnv4') - self.assertTrue(len(dst) == 2) + self.assertEqual(len(dst), 2) dst = self.g6.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue([self.g5.asn, self.g4.asn, self.g1.asn] == path['aspath']) + self.assertEqual([self.g5.asn, self.g4.asn, self.g1.asn], path['aspath']) dst = self.g7.get_global_rib('10.0.0.0/24') - self.assertTrue(len(dst) == 1) - self.assertTrue(len(dst[0]['paths']) == 1) + self.assertEqual(len(dst), 1) + self.assertEqual(len(dst[0]['paths']), 1) path = dst[0]['paths'][0] - self.assertTrue([self.g5.asn, self.g4.asn, self.g3.asn] == path['aspath']) + self.assertEqual([self.g5.asn, self.g4.asn, self.g3.asn], path['aspath']) if __name__ == '__main__': |