Skip to content

Commit 4117674

Browse files
test: fix the usage so the tests can pass in g3 (#498)
* fix: fix the usage so the tests can pass in g3 * use frozenset
1 parent bce0067 commit 4117674

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎packages/google-auth/google/auth/jwt.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
_DEFAULT_TOKEN_LIFETIME_SECS = 3600 # 1 hour in seconds
6868
_DEFAULT_MAX_CACHE_SIZE = 10
6969
_ALGORITHM_TO_VERIFIER_CLASS = {"RS256": crypt.RSAVerifier}
70-
_CRYPTOGRAPHY_BASED_ALGORITHMS = set(["ES256"])
70+
_CRYPTOGRAPHY_BASED_ALGORITHMS = frozenset(["ES256"])
7171

7272
if es256 is not None: # pragma: NO COVER
7373
_ALGORITHM_TO_VERIFIER_CLASS["ES256"] = es256.ES256Verifier

‎packages/google-auth/tests/transport/test_requests.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def make_guard(self, *args, **kwargs):
5555

5656
def test_tracks_elapsed_time_w_numeric_timeout(self, frozen_time):
5757
with self.make_guard(timeout=10) as guard:
58-
frozen_time.tick(delta=3.8)
58+
frozen_time.tick(delta=datetime.timedelta(seconds=3.8))
5959
assert guard.remaining_timeout == 6.2
6060

6161
def test_tracks_elapsed_time_w_tuple_timeout(self, frozen_time):
6262
with self.make_guard(timeout=(16, 19)) as guard:
63-
frozen_time.tick(delta=3.8)
63+
frozen_time.tick(delta=datetime.timedelta(seconds=3.8))
6464
assert guard.remaining_timeout == (12.2, 15.2)
6565

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

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

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

8888
with pytest.raises(FooError):
8989
with self.make_guard(timeout=1, timeout_error_type=FooError):
90-
frozen_time.tick(2)
90+
frozen_time.tick(delta=datetime.timedelta(seconds=2))
9191

9292
def test_lets_suite_errors_bubble_up(self, frozen_time):
9393
with pytest.raises(IndexError):
@@ -222,7 +222,7 @@ def test_request_default_timeout(self):
222222
authed_session.request("GET", self.TEST_URL)
223223

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

227227
def test_request_no_refresh(self):
228228
credentials = mock.Mock(wraps=CredentialsStub())

0 commit comments

Comments
 (0)