Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
system:homeautomation:home-assistant
python-google-api-python-client
opensuse-remove-oauth2client-tests.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File opensuse-remove-oauth2client-tests.patch of Package python-google-api-python-client
Index: google-api-python-client-2.56.0/tests/test__auth.py =================================================================== --- google-api-python-client-2.56.0.orig/tests/test__auth.py +++ google-api-python-client-2.56.0/tests/test__auth.py @@ -18,7 +18,6 @@ from unittest import mock import google.auth.credentials import google_auth_httplib2 import httplib2 -import oauth2client.client from googleapiclient import _auth @@ -26,11 +25,9 @@ from googleapiclient import _auth class TestAuthWithGoogleAuth(unittest.TestCase): def setUp(self): _auth.HAS_GOOGLE_AUTH = True - _auth.HAS_OAUTH2CLIENT = False def tearDown(self): _auth.HAS_GOOGLE_AUTH = True - _auth.HAS_OAUTH2CLIENT = True def test_default_credentials(self): with mock.patch("google.auth.default", autospec=True) as default: @@ -105,75 +102,12 @@ class TestAuthWithGoogleAuth(unittest.Te self.assertGreater(authorized_http.http.timeout, 0) -class TestAuthWithOAuth2Client(unittest.TestCase): - def setUp(self): - _auth.HAS_GOOGLE_AUTH = False - _auth.HAS_OAUTH2CLIENT = True - - def tearDown(self): - _auth.HAS_GOOGLE_AUTH = True - _auth.HAS_OAUTH2CLIENT = True - - def test_default_credentials(self): - default_patch = mock.patch( - "oauth2client.client.GoogleCredentials.get_application_default" - ) - - with default_patch as default: - default.return_value = mock.sentinel.credentials - - credentials = _auth.default_credentials() - - self.assertEqual(credentials, mock.sentinel.credentials) - - def test_credentials_from_file(self): - with self.assertRaises(EnvironmentError): - credentials = _auth.credentials_from_file("credentials.json") - - def test_default_credentials_with_scopes_and_quota_project(self): - with self.assertRaises(EnvironmentError): - credentials = _auth.default_credentials( - scopes=["1", "2"], quota_project_id="my-project" - ) - - def test_with_scopes_non_scoped(self): - credentials = mock.Mock(spec=oauth2client.client.Credentials) - - returned = _auth.with_scopes(credentials, mock.sentinel.scopes) - - self.assertEqual(credentials, returned) - - def test_with_scopes_scoped(self): - credentials = mock.Mock(spec=oauth2client.client.GoogleCredentials) - credentials.create_scoped_required.return_value = True - - returned = _auth.with_scopes(credentials, mock.sentinel.scopes) - - self.assertNotEqual(credentials, returned) - self.assertEqual(returned, credentials.create_scoped.return_value) - credentials.create_scoped.assert_called_once_with(mock.sentinel.scopes) - - def test_authorized_http(self): - credentials = mock.Mock(spec=oauth2client.client.Credentials) - - authorized_http = _auth.authorized_http(credentials) - - http = credentials.authorize.call_args[0][0] - - self.assertEqual(authorized_http, credentials.authorize.return_value) - self.assertIsInstance(http, httplib2.Http) - self.assertIsInstance(http.timeout, int) - self.assertGreater(http.timeout, 0) - - class TestAuthWithoutAuth(unittest.TestCase): def setUp(self): _auth.HAS_GOOGLE_AUTH = False - _auth.HAS_OAUTH2CLIENT = False def tearDown(self): _auth.HAS_GOOGLE_AUTH = True - _auth.HAS_OAUTH2CLIENT = True def test_default_credentials(self): with self.assertRaises(EnvironmentError): Index: google-api-python-client-2.56.0/tests/test_discovery.py =================================================================== --- google-api-python-client-2.56.0.orig/tests/test_discovery.py +++ google-api-python-client-2.56.0/tests/test_discovery.py @@ -43,8 +43,6 @@ import google.auth.credentials from google.auth.exceptions import MutualTLSChannelError import google_auth_httplib2 import httplib2 -from oauth2client import GOOGLE_TOKEN_URI -from oauth2client.client import GoogleCredentials, OAuth2Credentials from parameterized import parameterized import uritemplate @@ -1498,14 +1496,6 @@ class Discovery(unittest.TestCase): self.assertTrue(getattr(plus, "activities")) self.assertTrue(getattr(plus, "people")) - def test_oauth2client_credentials(self): - credentials = mock.Mock(spec=GoogleCredentials) - credentials.create_scoped_required.return_value = False - - discovery = read_datafile("plus.json") - service = build_from_document(discovery, credentials=credentials) - self.assertEqual(service._http, credentials.authorize.return_value) - def test_google_auth_credentials(self): credentials = mock.Mock(spec=google.auth.credentials.Credentials) discovery = read_datafile("plus.json") @@ -2166,36 +2156,6 @@ class Discovery(unittest.TestCase): http.request = wrapped_request return http - def _dummy_token(self): - access_token = "foo" - client_id = "some_client_id" - client_secret = "cOuDdkfjxxnv+" - refresh_token = "1/0/a.df219fjls0" - token_expiry = datetime.datetime.utcnow() - user_agent = "refresh_checker/1.0" - return OAuth2Credentials( - access_token, - client_id, - client_secret, - refresh_token, - token_expiry, - GOOGLE_TOKEN_URI, - user_agent, - ) - - def test_pickle_with_credentials(self): - credentials = self._dummy_token() - http = self._dummy_zoo_request() - http = credentials.authorize(http) - self.assertTrue(hasattr(http.request, "credentials")) - - zoo = build("zoo", "v1", http=http, static_discovery=False) - pickled_zoo = pickle.dumps(zoo) - new_zoo = pickle.loads(pickled_zoo) - self.assertEqual(sorted(zoo.__dict__.keys()), sorted(new_zoo.__dict__.keys())) - new_http = new_zoo._http - self.assertFalse(hasattr(new_http.request, "credentials")) - def test_resumable_media_upload_no_content(self): self.http = HttpMock(datafile("zoo.json"), {"status": "200"}) zoo = build("zoo", "v1", http=self.http, static_discovery=False)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor