def test_v6_arpa_boundary_32bit(self): """Test generating 32-bit v6 boundary""" rdns = ip_to_rdns(VALID_V6_1, boundary=True, v6_boundary=32) self.assertEqual(rdns, VALID_V6_1_32BOUND)
def test_v4_arpa_boundary_24bit(self): """Test generating 24-bit v4 boundary""" rdns = ip_to_rdns(VALID_V4_1, boundary=True, v4_boundary=24) self.assertEqual(rdns, VALID_V4_1_24BOUND)
def test_v6_arpa_boundary_16bit(self): """Test generating 16-bit v6 boundary""" rdns = ip_to_rdns(VALID_V6_1, boundary=True, v6_boundary=16) self.assertEqual(rdns, VALID_V6_1_16BOUND)
def test_v4_to_arpa(self): """Test generating rDNS for standard v4""" rdns = ip_to_rdns(VALID_V4_2) self.assertEqual(rdns, VALID_V4_2_RDNS)
def test_v6_to_arpa(self): """Test generating rDNS for standard v6""" rdns = ip_to_rdns(VALID_V6_1) self.assertEqual(rdns, VALID_V6_1_RDNS)
def test_v6_inv_boundary(self): """Raise if IPv6 boundary isn't dividable by 4""" with self.assertRaises(BoundaryException): ip_to_rdns(VALID_V6_1, boundary=True, v6_boundary=9)
def test_v6_inv_boundary_2(self): """Raise if IPv6 boundary is too short""" with self.assertRaises(BoundaryException): ip_to_rdns(VALID_V6_1, boundary=True, v6_boundary=0)
def test_v4_inv_boundary(self): """Raise if IPv4 boundary isn't divisable by 8""" with self.assertRaises(BoundaryException): ip_to_rdns(VALID_V4_2, boundary=True, v4_boundary=7)
def test_v6_invalid_2(self): """Raise if v6 address has invalid chars""" with self.assertRaises(ValueError): ip_to_rdns('2001::fh')
def test_v6_invalid(self): """Raise if IPv6 address has invalid block formatting""" with self.assertRaises(ValueError): ip_to_rdns('2001::ff::a')
def test_v4_invalid_2(self): """Raise if IPv4 address has octet out of range""" with self.assertRaises(ValueError): ip_to_rdns('127.0.0.373')
def test_v4_invalid(self): """Raise if IPv4 address has < 4 octets""" with self.assertRaises(ValueError): ip_to_rdns('127.0.0')