def test_pdb_to_ixp(self): expected = peerfinder.IXP( name="Test IX", subnet4=[IPv4Address("192.0.2.1")], subnet6=[IPv6Address("0100::")], ) self.assertEqual(expected, peerfinder.pdb_to_ixp(self.netixlan_set))
def test_fetch_different_ixps(self): ix1 = peerfinder.IXP( name="Test IX1", subnet4=[IPv4Address("192.0.2.1")], subnet6=[IPv6Address("0100::")], speed=1000, ) ix2 = peerfinder.IXP( name="Test IX2", subnet4=[IPv4Address("192.0.2.2")], subnet6=[IPv6Address("0100::")], speed=1000, ) expected = ["Test IX1", "Test IX2"] peer1 = peerfinder.Peer(name="peer1", ASN=1, present_in=[], peering_on=[ix1]) peer2 = peerfinder.Peer(name="peer2", ASN=1, present_in=[], peering_on=[ix2]) self.assertEqual(expected, peerfinder.fetch_different_ixps([peer1, peer2]))
def test_print_uncommon(self): ix1 = peerfinder.IXP( name="Test IX1", subnet4=[IPv4Address("192.0.2.1")], subnet6=[IPv6Address("0100::")], speed=1000, ) ix2 = peerfinder.IXP( name="Test IX2", subnet4=[IPv4Address("192.0.2.2")], subnet6=[IPv6Address("0100::")], speed=1000, ) peer1 = peerfinder.Peer(name="peer1", ASN=1, present_in=[], peering_on=[ix1]) peer2 = peerfinder.Peer( name="peer2", ASN=1, present_in=[], peering_on=[ix1, ix2] ) self.assertIsNone(peerfinder.print_uncommon([peer1, peer2]))