コード例 #1
0
ファイル: greendns_test.py プロジェクト: cloudera/hue
 def test_noraise_dns_tcp(self):
     # https://github.com/eventlet/eventlet/issues/499
     expected_ip = "192.168.1.1"
     with tests.dns_tcp_server(expected_ip) as dnsaddr:
         resolver = Resolver()
         resolver.nameservers = [dnsaddr[0]]
         resolver.nameserver_ports[dnsaddr[0]] = dnsaddr[1]
         response = resolver.query('host.example.com', 'a', tcp=True)
         self.assertIsInstance(response, Answer)
         self.assertEqual(response.rrset.items[0].address, expected_ip)
コード例 #2
0
 def test_noraise_dns_tcp(self):
     # https://github.com/eventlet/eventlet/issues/499
     expected_ip = "192.168.1.1"
     with tests.dns_tcp_server(expected_ip) as dnsaddr:
         resolver = Resolver()
         resolver.nameservers = [dnsaddr[0]]
         resolver.nameserver_ports[dnsaddr[0]] = dnsaddr[1]
         response = resolver.query('host.example.com', 'a', tcp=True)
         self.assertIsInstance(response, Answer)
         self.assertEqual(response.rrset.items[0].address, expected_ip)
コード例 #3
0
ファイル: greendns_test.py プロジェクト: cloudera/hue
    def test_raise_dns_tcp(self):
        # https://github.com/eventlet/eventlet/issues/499
        # None means we don't want the server to find the IP
        with tests.dns_tcp_server(None) as dnsaddr:
            resolver = Resolver()
            resolver.nameservers = [dnsaddr[0]]
            resolver.nameserver_ports[dnsaddr[0]] = dnsaddr[1]

            with self.assertRaises(NoAnswer):
                resolver.query('host.example.com', 'a', tcp=True)
コード例 #4
0
    def test_raise_dns_tcp(self):
        # https://github.com/eventlet/eventlet/issues/499
        # None means we don't want the server to find the IP
        with tests.dns_tcp_server(None) as dnsaddr:
            resolver = Resolver()
            resolver.nameservers = [dnsaddr[0]]
            resolver.nameserver_ports[dnsaddr[0]] = dnsaddr[1]

            with self.assertRaises(NoAnswer):
                resolver.query('host.example.com', 'a', tcp=True)