diff options
author | robot-piglet <[email protected]> | 2025-01-09 12:03:20 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2025-01-09 12:15:35 +0300 |
commit | 22152213a5c128f39919ace8973c35dcd27006c9 (patch) | |
tree | ca53d34968e2506220bce9e4f7236530981a6e98 /contrib/python/google-auth/py3/tests | |
parent | 5c8600386e6385fe569ed75001f660bdbce0d5ef (diff) |
Intermediate changes
commit_hash:053fd97561e2c88a136be1814e3340831ebd8c49
Diffstat (limited to 'contrib/python/google-auth/py3/tests')
-rw-r--r-- | contrib/python/google-auth/py3/tests/oauth2/test_id_token.py | 23 | ||||
-rw-r--r-- | contrib/python/google-auth/py3/tests/ya.make | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/contrib/python/google-auth/py3/tests/oauth2/test_id_token.py b/contrib/python/google-auth/py3/tests/oauth2/test_id_token.py index 8657bdfb7eb..65189df128c 100644 --- a/contrib/python/google-auth/py3/tests/oauth2/test_id_token.py +++ b/contrib/python/google-auth/py3/tests/oauth2/test_id_token.py @@ -79,6 +79,29 @@ def test_verify_token(_fetch_certs, decode): ) [email protected]("google.oauth2.id_token._fetch_certs", autospec=True) [email protected]("jwt.PyJWKClient", autospec=True) [email protected]("jwt.decode", autospec=True) +def test_verify_token_jwk(decode, py_jwk, _fetch_certs): + certs_url = "abc123" + data = {"keys": [{"alg": "RS256"}]} + _fetch_certs.return_value = data + result = id_token.verify_token( + mock.sentinel.token, mock.sentinel.request, certs_url=certs_url + ) + assert result == decode.return_value + py_jwk.assert_called_once_with(certs_url) + signing_key = py_jwk.return_value.get_signing_key_from_jwt + _fetch_certs.assert_called_once_with(mock.sentinel.request, certs_url) + signing_key.assert_called_once_with(mock.sentinel.token) + decode.assert_called_once_with( + mock.sentinel.token, + signing_key.return_value.key, + algorithms=[signing_key.return_value.algorithm_name], + audience=None, + ) + + @mock.patch("google.auth.jwt.decode", autospec=True) @mock.patch("google.oauth2.id_token._fetch_certs", autospec=True) def test_verify_token_args(_fetch_certs, decode): diff --git a/contrib/python/google-auth/py3/tests/ya.make b/contrib/python/google-auth/py3/tests/ya.make index 23e821bb9ae..75985e24d78 100644 --- a/contrib/python/google-auth/py3/tests/ya.make +++ b/contrib/python/google-auth/py3/tests/ya.make @@ -11,6 +11,7 @@ PEERDIR( contrib/python/freezegun contrib/python/aioresponses contrib/python/pytest-asyncio + contrib/python/PyJWT ) DATA( |