Hello community,

here is the log from the commit of package python-google-auth-oauthlib for 
openSUSE:Factory checked in at 2019-09-27 14:46:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-google-auth-oauthlib (Old)
 and      /work/SRC/openSUSE:Factory/.python-google-auth-oauthlib.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-google-auth-oauthlib"

Fri Sep 27 14:46:33 2019 rev:2 rq:730378 version:0.4.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-google-auth-oauthlib/python-google-auth-oauthlib.changes
  2019-05-06 13:27:12.157257363 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-google-auth-oauthlib.new.2352/python-google-auth-oauthlib.changes
        2019-09-27 14:46:45.721027878 +0200
@@ -1,0 +2,10 @@
+Thu Sep 12 11:30:53 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.4.0:
+  * Add get_user_credentials function to get your user credentials (#40)
+  * Add noxfile (#43)
+  * Implement code verifier (PKCE) (#42)
+  * Use actual server port in redirect_uri to allow automatic assignment (#33)
+  * Fix links after repo move to googleapis (#41)
+
+-------------------------------------------------------------------

Old:
----
  google-auth-oauthlib-0.3.0.tar.gz

New:
----
  google-auth-oauthlib-0.4.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-google-auth-oauthlib.spec ++++++
--- /var/tmp/diff_new_pack.uzz33p/_old  2019-09-27 14:46:46.725025267 +0200
+++ /var/tmp/diff_new_pack.uzz33p/_new  2019-09-27 14:46:46.729025257 +0200
@@ -12,21 +12,27 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-google-auth-oauthlib
-Version:        0.3.0
+Version:        0.4.0
 Release:        0
-License:        Apache-2.0
 Summary:        Google authentication library
-Url:            
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
+License:        Apache-2.0
 Group:          Development/Languages/Python
+URL:            
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
 Source:         
https://files.pythonhosted.org/packages/source/g/google-auth-oauthlib/google-auth-oauthlib-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
+Requires:       python-google-auth
+Requires:       python-requests-oauthlib >= 0.7.0
+Requires:       python-six
+Recommends:     python-click
+BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module click}
 BuildRequires:  %{python_module google-auth}
@@ -36,15 +42,9 @@
 BuildRequires:  %{python_module six}
 BuildRequires:  python-futures
 # /SECTION
-Requires:       python-google-auth
-Requires:       python-requests-oauthlib >= 0.7.0
-Requires:       python-six
-Recommends:     python-click
 %ifpython2
 Requires:       python-futures
 %endif
-BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -63,7 +63,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-%python_expand pytest-%{$python_bin_suffix}
+%pytest
 
 %files %{python_files}
 %doc README.rst

++++++ google-auth-oauthlib-0.3.0.tar.gz -> google-auth-oauthlib-0.4.0.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-auth-oauthlib-0.3.0/PKG-INFO 
new/google-auth-oauthlib-0.4.0/PKG-INFO
--- old/google-auth-oauthlib-0.3.0/PKG-INFO     2019-03-22 19:19:09.000000000 
+0100
+++ new/google-auth-oauthlib-0.4.0/PKG-INFO     2019-06-11 00:26:58.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: google-auth-oauthlib
-Version: 0.3.0
+Version: 0.4.0
 Summary: Google Authentication Library
 Home-page: 
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
 Author: Google Cloud Platform
@@ -13,15 +13,15 @@
         
         This library provides `oauthlib`_ integration with `google-auth`_.
         
-        .. |build| image:: 
https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python-oauthlib.svg?branch=master
-           :target: 
https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python-oauthlib
+        .. |build| image:: 
https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=master
+           :target: 
https://travis-ci.org/googleapis/google-auth-library-python-oauthlib
         .. |docs| image:: 
https://readthedocs.org/projects/google-auth-oauthlib/badge/?version=latest
            :target: https://google-auth-oauthlib.readthedocs.io/en/latest/
         .. |pypi| image:: 
https://img.shields.io/pypi/v/google-auth-oauthlib.svg
            :target: https://pypi.python.org/pypi/google-auth-oauthlib
         
         .. _oauthlib: https://github.com/idan/oauthlib
-        .. _google-auth: https://github.com/GoogleCloudPlatform/google-auth
+        .. _google-auth: 
https://github.com/googleapis/google-auth-library-python
         
         Installing
         ----------
@@ -44,7 +44,7 @@
         
         Apache 2.0 - See `the LICENSE`_ for more information.
         
-        .. _the LICENSE: 
https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/master/LICENSE
+        .. _the LICENSE: 
https://github.com/googleapis/google-auth-library-python-oauthlib/blob/master/LICENSE
         
 Keywords: google auth oauth client oauthlib
 Platform: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-auth-oauthlib-0.3.0/README.rst 
new/google-auth-oauthlib-0.4.0/README.rst
--- old/google-auth-oauthlib-0.3.0/README.rst   2019-03-19 17:13:47.000000000 
+0100
+++ new/google-auth-oauthlib-0.4.0/README.rst   2019-06-05 01:54:16.000000000 
+0200
@@ -5,15 +5,15 @@
 
 This library provides `oauthlib`_ integration with `google-auth`_.
 
-.. |build| image:: 
https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python-oauthlib.svg?branch=master
-   :target: 
https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python-oauthlib
+.. |build| image:: 
https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=master
+   :target: 
https://travis-ci.org/googleapis/google-auth-library-python-oauthlib
 .. |docs| image:: 
https://readthedocs.org/projects/google-auth-oauthlib/badge/?version=latest
    :target: https://google-auth-oauthlib.readthedocs.io/en/latest/
 .. |pypi| image:: https://img.shields.io/pypi/v/google-auth-oauthlib.svg
    :target: https://pypi.python.org/pypi/google-auth-oauthlib
 
 .. _oauthlib: https://github.com/idan/oauthlib
-.. _google-auth: https://github.com/GoogleCloudPlatform/google-auth
+.. _google-auth: https://github.com/googleapis/google-auth-library-python
 
 Installing
 ----------
@@ -36,4 +36,4 @@
 
 Apache 2.0 - See `the LICENSE`_ for more information.
 
-.. _the LICENSE: 
https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/master/LICENSE
+.. _the LICENSE: 
https://github.com/googleapis/google-auth-library-python-oauthlib/blob/master/LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-auth-oauthlib-0.3.0/google_auth_oauthlib/__init__.py 
new/google-auth-oauthlib-0.4.0/google_auth_oauthlib/__init__.py
--- old/google-auth-oauthlib-0.3.0/google_auth_oauthlib/__init__.py     
2019-03-19 17:13:47.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/google_auth_oauthlib/__init__.py     
2019-06-10 22:10:05.000000000 +0200
@@ -0,0 +1,23 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""oauthlib integration for Google Auth
+
+This library provides `oauthlib <https://oauthlib.readthedocs.io/>`__
+integration with `google-auth <https://google-auth.readthedocs.io/>`__.
+"""
+
+from .interactive import get_user_credentials
+
+__all__ = ["get_user_credentials"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-auth-oauthlib-0.3.0/google_auth_oauthlib/flow.py 
new/google-auth-oauthlib-0.4.0/google_auth_oauthlib/flow.py
--- old/google-auth-oauthlib-0.3.0/google_auth_oauthlib/flow.py 2019-03-20 
18:20:54.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/google_auth_oauthlib/flow.py 2019-06-05 
01:54:16.000000000 +0200
@@ -51,9 +51,15 @@
 .. _OAuth 2.0 Authorization Flow:
     https://tools.ietf.org/html/rfc6749#section-1.2
 """
-
+from base64 import urlsafe_b64encode
+import hashlib
 import json
 import logging
+try:
+    from secrets import SystemRandom
+except ImportError:  # pragma: NO COVER
+    from random import SystemRandom
+from string import ascii_letters, digits
 import webbrowser
 import wsgiref.simple_server
 import wsgiref.util
@@ -89,7 +95,7 @@
 
     def __init__(
             self, oauth2session, client_type, client_config,
-            redirect_uri=None):
+            redirect_uri=None, code_verifier=None):
         """
         Args:
             oauth2session (requests_oauthlib.OAuth2Session):
@@ -101,6 +107,8 @@
             redirect_uri (str): The OAuth 2.0 redirect URI if known at flow
                 creation time. Otherwise, it will need to be set using
                 :attr:`redirect_uri`.
+            code_verifier (str): random string of 43-128 chars used to verify
+                the key exchange.using PKCE. Auto-generated if not provided.
 
         .. _client secrets:
             https://developers.google.com/api-client-library/python/guide
@@ -113,6 +121,7 @@
         self.oauth2session = oauth2session
         """requests_oauthlib.OAuth2Session: The OAuth 2.0 session."""
         self.redirect_uri = redirect_uri
+        self.code_verifier = code_verifier
 
     @classmethod
     def from_client_config(cls, client_config, scopes, **kwargs):
@@ -208,6 +217,18 @@
                 specify the ``state`` when constructing the :class:`Flow`.
         """
         kwargs.setdefault('access_type', 'offline')
+        if not self.code_verifier:
+            chars = ascii_letters+digits+'-._~'
+            rnd = SystemRandom()
+            random_verifier = [rnd.choice(chars) for _ in range(0, 128)]
+            self.code_verifier = ''.join(random_verifier)
+        code_hash = hashlib.sha256()
+        code_hash.update(str.encode(self.code_verifier))
+        unencoded_challenge = code_hash.digest()
+        b64_challenge = urlsafe_b64encode(unencoded_challenge)
+        code_challenge = b64_challenge.decode().split('=')[0]
+        kwargs.setdefault('code_challenge', code_challenge)
+        kwargs.setdefault('code_challenge_method', 'S256')
         url, state = self.oauth2session.authorization_url(
             self.client_config['auth_uri'], **kwargs)
 
@@ -237,6 +258,7 @@
                 :class:`~google.auth.credentials.Credentials` instance.
         """
         kwargs.setdefault('client_secret', self.client_config['client_secret'])
+        kwargs.setdefault('code_verifier', self.code_verifier)
         return self.oauth2session.fetch_token(
             self.client_config['token_uri'], **kwargs)
 
@@ -398,14 +420,14 @@
             google.oauth2.credentials.Credentials: The OAuth 2.0 credentials
                 for the user.
         """
-        self.redirect_uri = 'http://{}:{}/'.format(host, port)
-
-        auth_url, _ = self.authorization_url(**kwargs)
-
         wsgi_app = _RedirectWSGIApp(success_message)
         local_server = wsgiref.simple_server.make_server(
             host, port, wsgi_app, handler_class=_WSGIRequestHandler)
 
+        self.redirect_uri = 'http://{}:{}/'.format(
+            host, local_server.server_port)
+        auth_url, _ = self.authorization_url(**kwargs)
+
         if open_browser:
             webbrowser.open(auth_url, new=1, autoraise=True)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-auth-oauthlib-0.3.0/google_auth_oauthlib/interactive.py 
new/google-auth-oauthlib-0.4.0/google_auth_oauthlib/interactive.py
--- old/google-auth-oauthlib-0.3.0/google_auth_oauthlib/interactive.py  
1970-01-01 01:00:00.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/google_auth_oauthlib/interactive.py  
2019-06-10 22:10:05.000000000 +0200
@@ -0,0 +1,105 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Get user credentials from interactive code environments.
+
+This module contains helpers for getting user credentials from interactive
+code environments installed on a development machine, such as Jupyter
+notebooks.
+"""
+
+from __future__ import absolute_import
+
+import google_auth_oauthlib.flow
+
+
+def get_user_credentials(scopes, client_id, client_secret):
+    """Gets credentials associated with your Google user account.
+
+    This function authenticates using your user credentials by going through
+    the OAuth 2.0 flow. You'll open a browser window to authenticate to your
+    Google account. The permissions it requests correspond to the scopes
+    you've provided.
+
+    To obtain the ``client_id`` and ``client_secret``, create an **OAuth
+    client ID** with application type **Other** from the `Credentials page on
+    the Google Developer's Console
+    <https://console.developers.google.com/apis/credentials>`_. Learn more
+    with the `Authenticating as an end user
+    <https://cloud.google.com/docs/authentication/end-user>`_ guide.
+
+    Args:
+        scopes (Sequence[str]):
+            A list of scopes to use when authenticating to Google APIs. See
+            the `list of OAuth 2.0 scopes for Google APIs
+            <https://developers.google.com/identity/protocols/googlescopes>`_.
+        client_id (str):
+            A string that identifies your application to Google APIs. Find
+            this value in the `Credentials page on the Google Developer's
+            Console
+            <https://console.developers.google.com/apis/credentials>`_.
+        client_secret (str):
+            A string that verifies your application to Google APIs. Find this
+            value in the `Credentials page on the Google Developer's Console
+            <https://console.developers.google.com/apis/credentials>`_.
+
+    Returns:
+        google.oauth2.credentials.Credentials:
+            The OAuth 2.0 credentials for the user.
+
+    Examples:
+        Get credentials for your user account and use them to run a query
+        with BigQuery::
+
+            import google_auth_oauthlib
+
+            # TODO: Create a client ID for your project.
+            client_id = "YOUR-CLIENT-ID.apps.googleusercontent.com"
+            client_secret = "abc_ThIsIsAsEcReT"
+
+            # TODO: Choose the needed scopes for your applications.
+            scopes = ["https://www.googleapis.com/auth/cloud-platform";]
+
+            credentials = google_auth_oauthlib.get_user_credentials(
+                scopes, client_id, client_secret
+            )
+
+            # 1. Open the link.
+            # 2. Authorize the application to have access to your account.
+            # 3. Copy and paste the authorization code to the prompt.
+
+            # Use the credentials to construct a client for Google APIs.
+            from google.cloud import bigquery
+
+            bigquery_client = bigquery.Client(
+                credentials=credentials, project="your-project-id"
+            )
+            print(list(bigquery_client.query("SELECT 1").result()))
+    """
+
+    client_config = {
+        "installed": {
+            "client_id": client_id,
+            "client_secret": client_secret,
+            "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob"],
+            "auth_uri": "https://accounts.google.com/o/oauth2/auth";,
+            "token_uri": "https://oauth2.googleapis.com/token";,
+        }
+    }
+
+    app_flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_config(
+        client_config, scopes=scopes
+    )
+
+    return app_flow.run_console()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-auth-oauthlib-0.3.0/google_auth_oauthlib.egg-info/PKG-INFO 
new/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/PKG-INFO
--- old/google-auth-oauthlib-0.3.0/google_auth_oauthlib.egg-info/PKG-INFO       
2019-03-22 19:19:09.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/PKG-INFO       
2019-06-11 00:26:58.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: google-auth-oauthlib
-Version: 0.3.0
+Version: 0.4.0
 Summary: Google Authentication Library
 Home-page: 
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
 Author: Google Cloud Platform
@@ -13,15 +13,15 @@
         
         This library provides `oauthlib`_ integration with `google-auth`_.
         
-        .. |build| image:: 
https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python-oauthlib.svg?branch=master
-           :target: 
https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python-oauthlib
+        .. |build| image:: 
https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=master
+           :target: 
https://travis-ci.org/googleapis/google-auth-library-python-oauthlib
         .. |docs| image:: 
https://readthedocs.org/projects/google-auth-oauthlib/badge/?version=latest
            :target: https://google-auth-oauthlib.readthedocs.io/en/latest/
         .. |pypi| image:: 
https://img.shields.io/pypi/v/google-auth-oauthlib.svg
            :target: https://pypi.python.org/pypi/google-auth-oauthlib
         
         .. _oauthlib: https://github.com/idan/oauthlib
-        .. _google-auth: https://github.com/GoogleCloudPlatform/google-auth
+        .. _google-auth: 
https://github.com/googleapis/google-auth-library-python
         
         Installing
         ----------
@@ -44,7 +44,7 @@
         
         Apache 2.0 - See `the LICENSE`_ for more information.
         
-        .. _the LICENSE: 
https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/master/LICENSE
+        .. _the LICENSE: 
https://github.com/googleapis/google-auth-library-python-oauthlib/blob/master/LICENSE
         
 Keywords: google auth oauth client oauthlib
 Platform: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-auth-oauthlib-0.3.0/google_auth_oauthlib.egg-info/SOURCES.txt 
new/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/SOURCES.txt
--- old/google-auth-oauthlib-0.3.0/google_auth_oauthlib.egg-info/SOURCES.txt    
2019-03-22 19:19:09.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/SOURCES.txt    
2019-06-11 00:26:58.000000000 +0200
@@ -6,6 +6,7 @@
 google_auth_oauthlib/__init__.py
 google_auth_oauthlib/flow.py
 google_auth_oauthlib/helpers.py
+google_auth_oauthlib/interactive.py
 google_auth_oauthlib.egg-info/PKG-INFO
 google_auth_oauthlib.egg-info/SOURCES.txt
 google_auth_oauthlib.egg-info/dependency_links.txt
@@ -18,6 +19,7 @@
 tests/__init__.pyc
 tests/test_flow.py
 tests/test_helpers.py
+tests/test_interactive.py
 tests/test_tool.py
 tests/__pycache__/__init__.cpython-35.pyc
 tests/__pycache__/__init__.cpython-36.pyc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-auth-oauthlib-0.3.0/setup.py 
new/google-auth-oauthlib-0.4.0/setup.py
--- old/google-auth-oauthlib-0.3.0/setup.py     2019-03-22 19:18:32.000000000 
+0100
+++ new/google-auth-oauthlib-0.4.0/setup.py     2019-06-10 22:10:52.000000000 
+0200
@@ -34,7 +34,7 @@
 
 setup(
     name='google-auth-oauthlib',
-    version='0.3.0',
+    version='0.4.0',
     author='Google Cloud Platform',
     author_email='[email protected]',
     description='Google Authentication Library',
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_flow.cpython-27-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-27-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_flow.cpython-35-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-35-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_flow.cpython-36-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-36-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_flow.cpython-37-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-37-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_helpers.cpython-37-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_helpers.cpython-37-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_tool.cpython-27-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-27-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_tool.cpython-35-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-35-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_tool.cpython-36-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-36-PYTEST.pyc
 differ
Binary files 
old/google-auth-oauthlib-0.3.0/tests/__pycache__/test_tool.cpython-37-PYTEST.pyc
 and 
new/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-37-PYTEST.pyc
 differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-auth-oauthlib-0.3.0/tests/test_flow.py 
new/google-auth-oauthlib-0.4.0/tests/test_flow.py
--- old/google-auth-oauthlib-0.3.0/tests/test_flow.py   2019-03-20 
20:56:51.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/tests/test_flow.py   2019-06-05 
01:54:16.000000000 +0200
@@ -17,6 +17,7 @@
 from functools import partial
 import json
 import os
+import re
 
 import mock
 import pytest
@@ -87,6 +88,7 @@
     def test_authorization_url(self, instance):
         scope = 'scope_one'
         instance.oauth2session.scope = [scope]
+        instance.code_verifier = 'amanaplanacanalpanama'
         authorization_url_patch = mock.patch.object(
             instance.oauth2session, 'authorization_url',
             wraps=instance.oauth2session.authorization_url)
@@ -99,11 +101,14 @@
             authorization_url_spy.assert_called_with(
                 CLIENT_SECRETS_INFO['web']['auth_uri'],
                 access_type='offline',
-                prompt='consent')
+                prompt='consent',
+                code_challenge='2yN0TOdl0gkGwFOmtfx3f913tgEaLM2d2S0WlmG1Z6Q',
+                code_challenge_method='S256')
 
     def test_authorization_url_access_type(self, instance):
         scope = 'scope_one'
         instance.oauth2session.scope = [scope]
+        instance.code_verifier = 'amanaplanacanalpanama'
         authorization_url_patch = mock.patch.object(
             instance.oauth2session, 'authorization_url',
             wraps=instance.oauth2session.authorization_url)
@@ -115,9 +120,31 @@
             assert scope in url
             authorization_url_spy.assert_called_with(
                 CLIENT_SECRETS_INFO['web']['auth_uri'],
-                access_type='meep')
+                access_type='meep',
+                code_challenge='2yN0TOdl0gkGwFOmtfx3f913tgEaLM2d2S0WlmG1Z6Q',
+                code_challenge_method='S256')
+
+    def test_authorization_url_generated_verifier(self, instance):
+        scope = 'scope_one'
+        instance.oauth2session.scope = [scope]
+        authorization_url_path = mock.patch.object(
+            instance.oauth2session, 'authorization_url',
+            wraps=instance.oauth2session.authorization_url)
+
+        with authorization_url_path as authorization_url_spy:
+            instance.authorization_url()
+
+            _, kwargs = authorization_url_spy.call_args_list[0]
+            assert kwargs['code_challenge_method'] == 'S256'
+            assert len(instance.code_verifier) == 128
+            assert len(kwargs['code_challenge']) == 43
+            valid_verifier = r'^[A-Za-z0-9-._~]*$'
+            valid_challenge = r'^[A-Za-z0-9-_]*$'
+            assert re.match(valid_verifier, instance.code_verifier)
+            assert re.match(valid_challenge, kwargs['code_challenge'])
 
     def test_fetch_token(self, instance):
+        instance.code_verifier = 'amanaplanacanalpanama'
         fetch_token_patch = mock.patch.object(
             instance.oauth2session, 'fetch_token', autospec=True,
             return_value=mock.sentinel.token)
@@ -129,7 +156,8 @@
             fetch_token_mock.assert_called_with(
                 CLIENT_SECRETS_INFO['web']['token_uri'],
                 client_secret=CLIENT_SECRETS_INFO['web']['client_secret'],
-                code=mock.sentinel.code)
+                code=mock.sentinel.code,
+                code_verifier='amanaplanacanalpanama')
 
     def test_credentials(self, instance):
         instance.oauth2session.token = {
@@ -194,7 +222,7 @@
     @mock.patch('google_auth_oauthlib.flow.input', autospec=True)
     def test_run_console(self, input_mock, instance, mock_fetch_token):
         input_mock.return_value = mock.sentinel.code
-
+        instance.code_verifier = 'amanaplanacanalpanama'
         credentials = instance.run_console()
 
         assert credentials.token == mock.sentinel.access_token
@@ -204,7 +232,8 @@
         mock_fetch_token.assert_called_with(
             CLIENT_SECRETS_INFO['web']['token_uri'],
             client_secret=CLIENT_SECRETS_INFO['web']['client_secret'],
-            code=mock.sentinel.code)
+            code=mock.sentinel.code,
+            code_verifier='amanaplanacanalpanama')
 
     @pytest.mark.webtest
     @mock.patch('google_auth_oauthlib.flow.webbrowser', autospec=True)
@@ -213,6 +242,7 @@
         auth_redirect_url = urllib.parse.urljoin(
             'http://localhost:60452',
             self.REDIRECT_REQUEST_PATH)
+        instance.code_verifier = 'amanaplanacanalpanama'
 
         with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
             future = pool.submit(partial(
@@ -235,7 +265,8 @@
         mock_fetch_token.assert_called_with(
             CLIENT_SECRETS_INFO['web']['token_uri'],
             client_secret=CLIENT_SECRETS_INFO['web']['client_secret'],
-            authorization_response=expected_auth_response)
+            authorization_response=expected_auth_response,
+            code_verifier='amanaplanacanalpanama')
 
     @mock.patch('google_auth_oauthlib.flow.webbrowser', autospec=True)
     @mock.patch('wsgiref.simple_server.make_server', autospec=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-auth-oauthlib-0.3.0/tests/test_interactive.py 
new/google-auth-oauthlib-0.4.0/tests/test_interactive.py
--- old/google-auth-oauthlib-0.3.0/tests/test_interactive.py    1970-01-01 
01:00:00.000000000 +0100
+++ new/google-auth-oauthlib-0.4.0/tests/test_interactive.py    2019-06-10 
22:10:05.000000000 +0200
@@ -0,0 +1,44 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import mock
+
+
+def test_get_user_credentials():
+    from google_auth_oauthlib import flow
+    from google_auth_oauthlib import interactive as module_under_test
+
+    mock_flow_instance = mock.create_autospec(
+        flow.InstalledAppFlow,
+        instance=True
+    )
+
+    with mock.patch(
+            "google_auth_oauthlib.flow.InstalledAppFlow", autospec=True
+    ) as mock_flow:
+        mock_flow.from_client_config.return_value = mock_flow_instance
+        module_under_test.get_user_credentials(
+            ["scopes"],
+            "some-client-id",
+            "shh-secret",
+        )
+
+    mock_flow.from_client_config.assert_called_once_with(
+        mock.ANY,
+        scopes=["scopes"],
+    )
+    actual_client_config = mock_flow.from_client_config.call_args[0][0]
+    assert actual_client_config["installed"]["client_id"] == "some-client-id"
+    assert actual_client_config["installed"]["client_secret"] == "shh-secret"
+    mock_flow_instance.run_console.assert_called_once()


Reply via email to