Browse Source

Mock boto's unstubbed metadata api access

pull/769/head
Ross McFarland 4 years ago
parent
commit
4f036c77f8
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      tests/test_octodns_provider_route53.py

+ 10
- 2
tests/test_octodns_provider_route53.py View File

@ -394,8 +394,12 @@ class TestRoute53Provider(TestCase):
return (provider, stubber)
def test_process_desired_zone(self):
# with fallback boto makes an unstubbed call to the 169. metadata api, this
# stubs that bit out
@patch('botocore.credentials.CredentialResolver.load_credentials')
def test_process_desired_zone(self, fetch_metadata_token_mock):
provider, stubber = self._get_stubbed_fallback_auth_provider()
fetch_metadata_token_mock.side_effect = [None]
# No records, essentially a no-op
desired = Zone('unit.tests.', [])
@ -527,8 +531,12 @@ class TestRoute53Provider(TestCase):
list(got.records)[0].dynamic.rules[0].data['geos'])
self.assertFalse('geos' in list(got.records)[0].dynamic.rules[1].data)
def test_populate_with_fallback(self):
# with fallback boto makes an unstubbed call to the 169. metadata api, this
# stubs that bit out
@patch('botocore.credentials.CredentialResolver.load_credentials')
def test_populate_with_fallback(self, fetch_metadata_token_mock):
provider, stubber = self._get_stubbed_fallback_auth_provider()
fetch_metadata_token_mock.side_effect = [None]
got = Zone('unit.tests.', [])
with self.assertRaises(ClientError):


Loading…
Cancel
Save