예제 #1
0
 def test_resolve_ips_v4_convert(self):
     """Test :func:`.resolve_ips` returns IPv6-wrapped IPv4 addresses for ``microsoft.com`` when v4_convert is enabled + v6 version"""
     ips = helpers.resolve_ips('microsoft.com', 'v6', v4_convert=True)
     if ips is None or len(ips) == 0:
         return pytest.skip(
             f"Skipping test TestNetResolveIP.test_resolve_ips_v4_convert as v6-wrapped IPv4 addresses "
             f"aren't supported on this platform.")
     self.assertTrue(ips[0].startswith('::ffff:'))
예제 #2
0
 def test_resolve_ips_hiveseed_v6(self):
     """Test :func:`.resolve_ips` returns only v6 for ``hiveseed-fin.privex.io`` when version is set to v6"""
     ips = helpers.resolve_ips('hiveseed-fin.privex.io', 'v6')
     self.assertEqual(len(ips), 1)
     self.assertEqual(ips[0], '2a01:4f9:2a:3d4::2')
예제 #3
0
 def test_resolve_ips_hiveseed(self):
     """Test :func:`.resolve_ips` returns expected v4 + v6 for ``hiveseed-fin.privex.io``"""
     ips = helpers.resolve_ips('hiveseed-fin.privex.io')
     self.assertEqual(len(ips), 2)
     self.assertIn('2a01:4f9:2a:3d4::2', ips)
     self.assertIn('95.216.3.171', ips)
예제 #4
0
 def test_resolve_ips_v4_convert_false(self):
     """Test :func:`.resolve_ips` returns an empty list for ``microsoft.com`` when v6 requested without v4_convert"""
     ips = helpers.resolve_ips('microsoft.com', 'v6', v4_convert=False)
     self.assertEqual(len(ips), 0)
예제 #5
0
 def test_resolve_ips_hiveseed_v4(self):
     """Test :func:`.resolve_ips` returns only v4 for ``hiveseed-fin.privex.io`` when version is set to v4"""
     ips = helpers.resolve_ips('hiveseed-fin.privex.io', 'v4')
     self.assertEqual(len(ips), 1)
     self.assertEqual(ips[0], '95.216.3.171')
예제 #6
0
 def test_resolve_ips_ipv6_addr_invalid(self):
     """Test :func:`.resolve_ips` raises :class:`.AttributeError` when ``version`` is v6 but an IPv4 address was passed"""
     with self.assertRaises(AttributeError):
         helpers.resolve_ips('185.130.44.5', 'v6')
예제 #7
0
 def test_resolve_ips_ipv4_addr_invalid(self):
     """Test :func:`.resolve_ips` raises :class:`.AttributeError` when ``version`` is v4 but an IPv6 address was passed"""
     with self.assertRaises(AttributeError):
         helpers.resolve_ips('2a07:e00::333', 'v4')
예제 #8
0
 def test_resolve_ips_ipv6_addr(self):
     """Test :func:`.resolve_ips` returns the same IPv6 address passed to it"""
     ips = helpers.resolve_ips('2a07:e00::333')
     self.assertEqual(len(ips), 1)
     self.assertEqual(ips[0], '2a07:e00::333')
예제 #9
0
 def test_resolve_ips_ipv4_addr(self):
     """Test :func:`.resolve_ips` returns the same IPv4 address passed to it"""
     ips = helpers.resolve_ips('185.130.44.5')
     self.assertEqual(len(ips), 1)
     self.assertEqual(ips[0], '185.130.44.5')