Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/auth/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
_DEFAULT_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds
_DEFAULT_MAX_CACHE_SIZE = 10
_ALGORITHM_TO_VERIFIER_CLASS = {"RS256": crypt.RSAVerifier}
_CRYPTOGRAPHY_BASED_ALGORITHMS = set(["ES256"])
_CRYPTOGRAPHY_BASED_ALGORITHMS = frozenset(["ES256"])

if es256 is not None: # pragma: NO COVER
_ALGORITHM_TO_VERIFIER_CLASS["ES256"] = es256.ES256Verifier
Expand Down
12 changes: 6 additions & 6 deletions tests/transport/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ def make_guard(self, *args, **kwargs):

def test_tracks_elapsed_time_w_numeric_timeout(self, frozen_time):
with self.make_guard(timeout=10) as guard:
frozen_time.tick(delta=3.8)
frozen_time.tick(delta=datetime.timedelta(seconds=3.8))
assert guard.remaining_timeout == 6.2

def test_tracks_elapsed_time_w_tuple_timeout(self, frozen_time):
with self.make_guard(timeout=(16, 19)) as guard:
frozen_time.tick(delta=3.8)
frozen_time.tick(delta=datetime.timedelta(seconds=3.8))
assert guard.remaining_timeout == (12.2, 15.2)

def test_noop_if_no_timeout(self, frozen_time):
Expand All @@ -72,13 +72,13 @@ def test_noop_if_no_timeout(self, frozen_time):
def test_timeout_error_w_numeric_timeout(self, frozen_time):
with pytest.raises(requests.exceptions.Timeout):
with self.make_guard(timeout=10) as guard:
frozen_time.tick(delta=10.001)
frozen_time.tick(delta=datetime.timedelta(seconds=10.001))
assert guard.remaining_timeout == pytest.approx(-0.001)

def test_timeout_error_w_tuple_timeout(self, frozen_time):
with pytest.raises(requests.exceptions.Timeout):
with self.make_guard(timeout=(11, 10)) as guard:
frozen_time.tick(delta=10.001)
frozen_time.tick(delta=datetime.timedelta(seconds=10.001))
assert guard.remaining_timeout == pytest.approx((0.999, -0.001))

def test_custom_timeout_error_type(self, frozen_time):
Expand All @@ -87,7 +87,7 @@ class FooError(Exception):

with pytest.raises(FooError):
with self.make_guard(timeout=1, timeout_error_type=FooError):
frozen_time.tick(2)
frozen_time.tick(delta=datetime.timedelta(seconds=2))

def test_lets_suite_errors_bubble_up(self, frozen_time):
with pytest.raises(IndexError):
Expand Down Expand Up @@ -222,7 +222,7 @@ def test_request_default_timeout(self):
authed_session.request("GET", self.TEST_URL)

expected_timeout = google.auth.transport.requests._DEFAULT_TIMEOUT
assert patched_request.call_args.kwargs.get("timeout") == expected_timeout
assert patched_request.call_args[1]["timeout"] == expected_timeout

def test_request_no_refresh(self):
credentials = mock.Mock(wraps=CredentialsStub())
Expand Down