diff --git a/octodns/provider/constellix.py b/octodns/provider/constellix.py index 5ca89e1..7829386 100644 --- a/octodns/provider/constellix.py +++ b/octodns/provider/constellix.py @@ -44,7 +44,7 @@ class ConstellixClientNotFound(ConstellixClientException): class ConstellixClient(object): - BASE = 'https://api.dns.constellix.com/v1/domains' + BASE = 'https://api.dns.constellix.com/v1' def __init__(self, api_key, secret_key, ratelimit_delay=0.0): self.api_key = api_key @@ -88,7 +88,7 @@ class ConstellixClient(object): if self._domains is None: zones = [] - resp = self._request('GET', '').json() + resp = self._request('GET', '/domains').json() zones += resp self._domains = {'{}.'.format(z['name']): z['id'] for z in zones} @@ -103,7 +103,7 @@ class ConstellixClient(object): return self._request('GET', path).json() def domain_create(self, name): - resp = self._request('POST', '/', data={'names': [name]}) + resp = self._request('POST', '/domains', data={'names': [name]}) # Add newly created zone to domain cache self._domains['{}.'.format(name)] = resp.json()[0]['id'] @@ -119,7 +119,7 @@ class ConstellixClient(object): zone_id = self.domains.get(zone_name, False) if not zone_id: raise ConstellixClientNotFound() - path = '/{}/records'.format(zone_id) + path = '/domains/{}/records'.format(zone_id) resp = self._request('GET', path).json() for record in resp: @@ -151,7 +151,7 @@ class ConstellixClient(object): record_type = 'ANAME' zone_id = self.domains.get(zone_name, False) - path = '/{}/records/{}'.format(zone_id, record_type) + path = '/domains/{}/records/{}'.format(zone_id, record_type) self._request('POST', path, data=params) @@ -161,7 +161,8 @@ class ConstellixClient(object): record_type = 'ANAME' zone_id = self.domains.get(zone_name, False) - path = '/{}/records/{}/{}'.format(zone_id, record_type, record_id) + path = '/domains/{}/records/{}/{}'.format(zone_id, record_type, + record_id) self._request('DELETE', path) diff --git a/tests/test_octodns_provider_constellix.py b/tests/test_octodns_provider_constellix.py index 151d0d4..52a6b4c 100644 --- a/tests/test_octodns_provider_constellix.py +++ b/tests/test_octodns_provider_constellix.py @@ -144,15 +144,15 @@ class TestConstellixProvider(TestCase): provider._client._request.assert_has_calls([ # get all domains to build the cache - call('GET', ''), + call('GET', '/domains'), # created the domain - call('POST', '/', data={'names': ['unit.tests']}) + call('POST', '/domains', data={'names': ['unit.tests']}) ]) # These two checks are broken up so that ordering doesn't break things. # Python3 doesn't make the calls in a consistent order so different # things follow the GET / on different runs provider._client._request.assert_has_calls([ - call('POST', '/123123/records/SRV', data={ + call('POST', '/domains/123123/records/SRV', data={ 'roundRobin': [{ 'priority': 10, 'weight': 20, @@ -218,14 +218,14 @@ class TestConstellixProvider(TestCase): # recreate for update, and deletes for the 2 parts of the other provider._client._request.assert_has_calls([ - call('POST', '/123123/records/A', data={ + call('POST', '/domains/123123/records/A', data={ 'roundRobin': [{ 'value': '3.2.3.4' }], 'name': 'ttl', 'ttl': 300 }), - call('DELETE', '/123123/records/A/11189897'), - call('DELETE', '/123123/records/A/11189898'), - call('DELETE', '/123123/records/ANAME/11189899') + call('DELETE', '/domains/123123/records/A/11189897'), + call('DELETE', '/domains/123123/records/A/11189898'), + call('DELETE', '/domains/123123/records/ANAME/11189899') ], any_order=True)