예제 #1
0
    def test_query_no_nameservers(self):
        resolver = dns.resolver.Resolver()
        domain = dns.name.from_text('example.com.')

        with unittest.mock.patch.object(resolver, 'query', side_effect=dns.resolver.NoNameservers()):
            result = fierce.query(resolver, domain)

        self.assertIsNone(result)
예제 #2
0
    def test_query_timeout(self):
        resolver = dns.resolver.Resolver()
        domain = dns.name.from_text('example.com.')

        with unittest.mock.patch.object(resolver, 'query', side_effect=dns.exception.Timeout()):
            result = fierce.query(resolver, domain)

        self.assertIsNone(result)
예제 #3
0
    def test_query_nxdomain(self):
        resolver = dns.resolver.Resolver()
        domain = dns.name.from_text('example.com.')

        with unittest.mock.patch.object(resolver,
                                        'query',
                                        side_effect=dns.resolver.NXDOMAIN()):
            result = fierce.query(resolver, domain)

        assert result is None