Skip to content

Commit bf9ca3b

Browse files
author
Jon Wayne Parrott
authored
Switch from oauth2client to google-auth (#2726)
* Removes all use of oauth2client from every package and tests. * Updates core to use google-auth's default credentials, project ID, and scoping logic. * Updates bigtable to use google-auth's scoping logic.
1 parent ede9b4f commit bf9ca3b

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

packages/google-cloud-resource-manager/unit_tests/test_client.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_constructor(self):
2929
from google.cloud.resource_manager.connection import Connection
3030

3131
http = object()
32-
credentials = _Credentials()
32+
credentials = object()
3333
client = self._make_one(credentials=credentials, http=http)
3434
self.assertIsInstance(client._connection, Connection)
3535
self.assertEqual(client._connection._credentials, credentials)
@@ -38,7 +38,7 @@ def test_constructor(self):
3838
def test_new_project_factory(self):
3939
from google.cloud.resource_manager.project import Project
4040

41-
credentials = _Credentials()
41+
credentials = object()
4242
client = self._make_one(credentials=credentials)
4343
project_id = 'project_id'
4444
name = object()
@@ -66,7 +66,7 @@ def test_fetch_project(self):
6666
'lifecycleState': 'ACTIVE',
6767
}
6868

69-
credentials = _Credentials()
69+
credentials = object()
7070
client = self._make_one(credentials=credentials)
7171
# Patch the connection with one we can easily control.
7272
client._connection = _Connection(project_resource)
@@ -81,7 +81,7 @@ def test_fetch_project(self):
8181
def test_list_projects_return_type(self):
8282
from google.cloud.iterator import HTTPIterator
8383

84-
credentials = _Credentials()
84+
credentials = object()
8585
client = self._make_one(credentials=credentials)
8686
# Patch the connection with one we can easily control.
8787
client._connection = _Connection({})
@@ -90,7 +90,7 @@ def test_list_projects_return_type(self):
9090
self.assertIsInstance(results, HTTPIterator)
9191

9292
def test_list_projects_no_paging(self):
93-
credentials = _Credentials()
93+
credentials = object()
9494
client = self._make_one(credentials=credentials)
9595

9696
PROJECT_ID = 'project-id'
@@ -118,7 +118,7 @@ def test_list_projects_no_paging(self):
118118
self.assertEqual(project.status, STATUS)
119119

120120
def test_list_projects_with_paging(self):
121-
credentials = _Credentials()
121+
credentials = object()
122122
client = self._make_one(credentials=credentials)
123123

124124
PROJECT_ID1 = 'project-id'
@@ -181,7 +181,7 @@ def test_list_projects_with_paging(self):
181181
})
182182

183183
def test_list_projects_with_filter(self):
184-
credentials = _Credentials()
184+
credentials = object()
185185
client = self._make_one(credentials=credentials)
186186

187187
PROJECT_ID = 'project-id'
@@ -220,7 +220,7 @@ def test_list_projects_with_filter(self):
220220
def test_page_empty_response(self):
221221
from google.cloud.iterator import Page
222222

223-
credentials = _Credentials()
223+
credentials = object()
224224
client = self._make_one(credentials=credentials)
225225
iterator = client.list_projects()
226226
page = Page(iterator, (), None)
@@ -246,7 +246,7 @@ def test_page_non_empty_response(self):
246246
'lifecycleState': project_lifecycle_state,
247247
}
248248
response = {'projects': [api_resource]}
249-
credentials = _Credentials()
249+
credentials = object()
250250
client = self._make_one(credentials=credentials)
251251

252252
def dummy_response():
@@ -268,19 +268,6 @@ def dummy_response():
268268
self.assertEqual(project.status, project_lifecycle_state)
269269

270270

271-
class _Credentials(object):
272-
273-
_scopes = None
274-
275-
@staticmethod
276-
def create_scoped_required():
277-
return True
278-
279-
def create_scoped(self, scope):
280-
self._scopes = scope
281-
return self
282-
283-
284271
class _Connection(object):
285272

286273
def __init__(self, *responses):

0 commit comments

Comments
 (0)