Accepting request 970246 from home:bnavigator:branches:devel:languages:python

- Update to 2.44.0
  * * : update the api
  * deps: require google-api-core>=1.31.5, >=2.3.2 (#1715) (8308e5d)
  * remove adsense.v1.4.json (#1616) (5d3e588)
  * expose library version at googleapiclient.version (#1623) (83db1d7)
  * deps: require uritemplate 3.0.1 (#1629) (1c4cfdb)
- Do not test deprecated oauth2client anymore:
  * add opensuse-remove-oauth2client-tests.patch

OBS-URL: https://build.opensuse.org/request/show/970246
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-google-api-python-client?expand=0&rev=45
This commit is contained in:
2022-04-15 06:24:32 +00:00
committed by Git OBS Bridge
parent dbbe83caaa
commit d95b7a22f0
5 changed files with 199 additions and 19 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f64a5eee6fa03ab51806dccf48e342fda83fea60c290518c6a2dfdbf2de9efd
size 7436726

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fc9c31737b82a592d29636c6f77af9cf9666e45ed966d0a5ebe20711aa0df83c
size 7937116

View File

@@ -0,0 +1,165 @@
Index: google-api-python-client-2.44.0/tests/test__auth.py
===================================================================
--- google-api-python-client-2.44.0.orig/tests/test__auth.py
+++ google-api-python-client-2.44.0/tests/test__auth.py
@@ -18,7 +18,6 @@ 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:
@@ -103,75 +100,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.44.0/tests/test_discovery.py
===================================================================
--- google-api-python-client-2.44.0.orig/tests/test_discovery.py
+++ google-api-python-client-2.44.0/tests/test_discovery.py
@@ -82,8 +82,6 @@ from googleapiclient.http import MediaUp
from googleapiclient.http import tunnel_patch
from googleapiclient.model import JsonModel
from googleapiclient.schema import Schemas
-from oauth2client import GOOGLE_TOKEN_URI
-from oauth2client.client import OAuth2Credentials, GoogleCredentials
from googleapiclient import _helpers as util
@@ -1420,14 +1418,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")
@@ -2088,36 +2078,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)

View File

@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Thu Apr 14 19:30:07 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 2.44.0
* * : update the api
* deps: require google-api-core>=1.31.5, >=2.3.2 (#1715) (8308e5d)
* remove adsense.v1.4.json (#1616) (5d3e588)
* expose library version at googleapiclient.version (#1623) (83db1d7)
* deps: require uritemplate 3.0.1 (#1629) (1c4cfdb)
- Do not test deprecated oauth2client anymore:
* add opensuse-remove-oauth2client-tests.patch
-------------------------------------------------------------------
Wed Dec 1 16:58:38 UTC 2021 - Jan Baier <jbaier@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-google-api-python-client
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,36 +16,35 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%define skip_python36 1
Name: python-google-api-python-client
Version: 2.31.0
Version: 2.44.0
Release: 0
Summary: Google APIs Python Client
License: Apache-2.0
URL: https://github.com/google/google-api-python-client
Source: https://files.pythonhosted.org/packages/source/g/google-api-python-client/google-api-python-client-%{version}.tar.gz
BuildRequires: %{python_module google-api-core >= 1.21.0}
# PATCH-FIX-OPENSUSE opensuse-remove-oauth2client-tests.patch -- upstream wants to support and test deprecated oauth2client indefinitely, but
# the distro has to remove it at some point
Patch0: opensuse-remove-oauth2client-tests.patch
BuildRequires: %{python_module google-api-core >= 1.31.5}
BuildRequires: %{python_module google-auth >= 1.16.0}
BuildRequires: %{python_module google-auth-httplib2 >= 0.1.0}
BuildRequires: %{python_module httplib2 >= 0.15.0}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module oauth2client}
BuildRequires: %{python_module pandas}
BuildRequires: %{python_module parameterized}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six >= 1.13.0}
BuildRequires: %{python_module uritemplate >= 3.0.0}
BuildRequires: %{python_module uritemplate >= 3.0.1}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-google-api-core >= 1.21.0
Requires: python-google-api-core >= 1.31.5
Requires: python-google-auth >= 1.16.0
Requires: python-google-auth-httplib2 >= 0.1.0
Requires: python-httplib2 >= 0.15.0
Requires: python-six >= 1.13.0
Requires: python-uritemplate >= 3.0.0
Requires: python-uritemplate >= 3.0.1
# Package renamed in SLE 12, do not remove Provides, Obsolete directives
# until after SLE 12 EOL
Provides: google-api-python-client = %{version}
@@ -57,7 +56,7 @@ BuildArch: noarch
Google APIs Client Library for Python
%prep
%setup -q -n google-api-python-client-%{version}
%autosetup -p1 -n google-api-python-client-%{version}
%build
%python_build
@@ -67,14 +66,18 @@ Google APIs Client Library for Python
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# DiscoveryFromDocument::test_api_endpoint_override_from_client_options and
# DiscoveryFromDocument::test_api_endpoint_override_from_client_options_dict fail with "server unavailable"
# DiscoveryErrors::test_credentials_and_credentials_file_mutually_exclusive fails with "socket.gaierror: [Errno -3] Temporary failure in name resolution"
%pytest --ignore=samples -k "not (test_api_endpoint_override_from_client_options and Document) and not test_credentials_and_credentials_file_mutually_exclusive"
donttest="test_credentials_and_credentials_file_mutually_exclusive"
# don't test deprecated oaut2client usage
donttest="$donttest or TestAuthWithOAuth2Client or test_oauth2client_crendentials"
# test_http.py uses mocked Credentials class and API from deprecated oauth2client
%pytest --ignore=samples --ignore tests/test_http.py -k "not ($donttest)"
%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/*
%{python_sitelib}/apiclient
%{python_sitelib}/googleapiclient
%{python_sitelib}/google_api_python_client-%{version}*-info
%changelog