From 1fcfd71e70f351937b1c4ca7c1619a30360be4e6 Mon Sep 17 00:00:00 2001 From: Sijun Liu Date: Thu, 21 Oct 2021 18:49:47 +0000 Subject: [PATCH] fix: fix downscoped --- google/auth/downscoped.py | 12 +++++++----- system_tests/noxfile.py | 24 ++++-------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/google/auth/downscoped.py b/google/auth/downscoped.py index 96a4e6547..a1d7b6e46 100644 --- a/google/auth/downscoped.py +++ b/google/auth/downscoped.py @@ -50,6 +50,8 @@ import datetime +import six + from google.auth import _helpers from google.auth import credentials from google.oauth2 import sts @@ -221,7 +223,7 @@ def available_resource(self, value): Raises: TypeError: If the value is not a string. """ - if not isinstance(value, str): + if not isinstance(value, six.string_types): raise TypeError("The provided available_resource is not a string.") self._available_resource = value @@ -247,7 +249,7 @@ def available_permissions(self, value): ValueError: If the value is not valid. """ for available_permission in value: - if not isinstance(available_permission, str): + if not isinstance(available_permission, six.string_types): raise TypeError( "Provided available_permissions are not a list of strings." ) @@ -350,7 +352,7 @@ def expression(self, value): Raises: TypeError: If the value is not of type string. """ - if not isinstance(value, str): + if not isinstance(value, six.string_types): raise TypeError("The provided expression is not a string.") self._expression = value @@ -373,7 +375,7 @@ def title(self, value): Raises: TypeError: If the value is not of type string or None. """ - if not isinstance(value, str) and value is not None: + if not isinstance(value, six.string_types) and value is not None: raise TypeError("The provided title is not a string or None.") self._title = value @@ -396,7 +398,7 @@ def description(self, value): Raises: TypeError: If the value is not of type string or None. """ - if not isinstance(value, str) and value is not None: + if not isinstance(value, six.string_types) and value is not None: raise TypeError("The provided description is not a string or None.") self._description = value diff --git a/system_tests/noxfile.py b/system_tests/noxfile.py index a71dcaf95..459b71c78 100644 --- a/system_tests/noxfile.py +++ b/system_tests/noxfile.py @@ -383,9 +383,8 @@ def mtls_http(session): def external_accounts(session): session.install( *TEST_DEPENDENCIES_SYNC, - "google-auth", + LIBRARY_DIR, "google-api-python-client", - "enum34", ) default( session, @@ -394,26 +393,11 @@ def external_accounts(session): ) -@nox.session(python=["2.7"]) -def downscoping_27(session): - session.install( - *TEST_DEPENDENCIES_SYNC, - "enum34", - "google-auth", - "google-cloud-storage", - ) - default( - session, - "system_tests_sync/test_downscoping.py", - *session.posargs, - ) - - -@nox.session(python=["3.7"]) -def downscoping_37(session): +@nox.session(python=PYTHON_VERSIONS_SYNC) +def downscoping(session): session.install( *TEST_DEPENDENCIES_SYNC, - "google-auth", + LIBRARY_DIR, "google-cloud-storage", ) default(