Fix cname_lookup test
c.badtest.com actually has a CNAME now, and apparently we're actually doing the look-up during tests. Change-Id: I306b7d05740a2b8fcef2f5f432ebf5211bc723cc
This commit is contained in:
parent
1859f2e161
commit
54fc8a7dee
@ -305,7 +305,9 @@ class TestCNAMELookup(unittest.TestCase):
|
||||
resp = do_test('c.badtest.com')
|
||||
self.assertEqual(resp, bad_domain)
|
||||
|
||||
def test_host_is_storage_domain(self):
|
||||
@mock.patch('dns.resolver.Resolver.query',
|
||||
side_effect=dns.exception.DNSException)
|
||||
def test_host_is_storage_domain(self, mock_lookup):
|
||||
conf = {'storage_domain': 'storage.example.com',
|
||||
'lookup_depth': 2}
|
||||
app = cname_lookup.CNAMELookupMiddleware(FakeApp(), conf)
|
||||
@ -318,9 +320,12 @@ class TestCNAMELookup(unittest.TestCase):
|
||||
bad_domain = [b'CNAME lookup failed to resolve to a valid domain']
|
||||
resp = do_test('c.badtest.com')
|
||||
self.assertEqual(resp, bad_domain)
|
||||
self.assertEqual(1, len(mock_lookup.mock_calls))
|
||||
mock_lookup.reset_mock()
|
||||
|
||||
resp = do_test('storage.example.com')
|
||||
self.assertEqual(resp, [b'FAKE APP'])
|
||||
self.assertEqual(0, len(mock_lookup.mock_calls))
|
||||
|
||||
def test_resolution_to_storage_domain_exactly(self):
|
||||
conf = {'storage_domain': 'example.com',
|
||||
|
Loading…
x
Reference in New Issue
Block a user