Skip to content

Commit

Permalink
Changing runtimeconfig Connection to only accept client.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Jan 27, 2017
1 parent f0adea3 commit c91fa4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 4 additions & 2 deletions runtimeconfig/google/cloud/runtimeconfig/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ class Client(ClientWithProject):
``credentials`` for the current object.
"""

SCOPE = ('https://www.googleapis.com/auth/cloudruntimeconfig',)
"""The scopes required for authenticating as a RuntimeConfig consumer."""

def __init__(self, project=None, credentials=None, http=None):
super(Client, self).__init__(
project=project, credentials=credentials, http=http)
self._connection = Connection(
credentials=self._credentials, http=self._http)
self._connection = Connection(self)

def config(self, config_name):
"""Factory constructor for config object.
Expand Down
3 changes: 0 additions & 3 deletions runtimeconfig/google/cloud/runtimeconfig/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,3 @@ class Connection(_http.JSONConnection):

API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

SCOPE = ('https://www.googleapis.com/auth/cloudruntimeconfig',)
"""The scopes required for authenticating as a RuntimeConfig consumer."""
6 changes: 3 additions & 3 deletions runtimeconfig/unit_tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_default_url(self):
creds = object()
conn = self._make_one(creds)
self.assertEqual(conn.credentials, creds)
client = object()
conn = self._make_one(client)
self.assertIs(conn._client, client)

0 comments on commit c91fa4a

Please sign in to comment.