Skip to content

Commit d961233

Browse files
committed
Changing DNS Connection to only accept client.
1 parent 047d13e commit d961233

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

dns/google/cloud/dns/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
from google.cloud.dns.resource_record_set import ResourceRecordSet
3333

3434

35-
SCOPE = Connection.SCOPE
35+
SCOPE = Client.SCOPE

dns/google/cloud/dns/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ class Client(ClientWithProject):
4343
``credentials`` for the current object.
4444
"""
4545

46+
SCOPE = ('https://www.googleapis.com/auth/ndev.clouddns.readwrite',)
47+
"""The scopes required for authenticating as a Cloud DNS consumer."""
48+
4649
def __init__(self, project=None, credentials=None, http=None):
4750
super(Client, self).__init__(
4851
project=project, credentials=credentials, http=http)
49-
self._connection = Connection(
50-
credentials=self._credentials, http=self._http)
52+
self._connection = Connection(self)
5153

5254
def quotas(self):
5355
"""Return DNS quotas for the project associated with this client.

dns/google/cloud/dns/connection.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,3 @@ class Connection(_http.JSONConnection):
2828

2929
API_URL_TEMPLATE = '{api_base_url}/dns/{api_version}{path}'
3030
"""A template for the URL of a particular API call."""
31-
32-
SCOPE = ('https://www.googleapis.com/auth/ndev.clouddns.readwrite',)
33-
"""The scopes required for authenticating as a Cloud DNS consumer."""

dns/unit_tests/test_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _make_one(self, *args, **kw):
2727
return self._get_target_class()(*args, **kw)
2828

2929
def test_build_api_url_no_extra_query_params(self):
30-
conn = self._make_one()
30+
conn = self._make_one(object())
3131
URI = '/'.join([
3232
conn.API_BASE_URL,
3333
'dns',
@@ -40,7 +40,7 @@ def test_build_api_url_w_extra_query_params(self):
4040
from six.moves.urllib.parse import parse_qsl
4141
from six.moves.urllib.parse import urlsplit
4242

43-
conn = self._make_one()
43+
conn = self._make_one(object())
4444
uri = conn.build_api_url('/foo', {'bar': 'baz'})
4545
scheme, netloc, path, qs, _ = urlsplit(uri)
4646
self.assertEqual('%s://%s' % (scheme, netloc), conn.API_BASE_URL)

0 commit comments

Comments
 (0)