From abbcdf00508313807289cc929fc204f282ccc8f1 Mon Sep 17 00:00:00 2001 From: Guillaume Pujol Date: Tue, 1 Oct 2024 15:28:47 +0200 Subject: [PATCH] fix warnings in tests (#76) --- tests/unit_tests/test_client.py | 10 +++++----- tests/unit_tests/test_oidc.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit_tests/test_client.py b/tests/unit_tests/test_client.py index 96cc638..e7d1844 100644 --- a/tests/unit_tests/test_client.py +++ b/tests/unit_tests/test_client.py @@ -84,7 +84,7 @@ def test_invalid_auth(token_endpoint: str) -> None: OAuth2Client( token_endpoint, client_secret="client_secret", - private_key=Jwk.generate_for_kty("EC", crv="P-256"), + private_key=Jwk.generate(alg="ES256"), ) @@ -1386,7 +1386,7 @@ def test_pushed_authorization_request_error( def test_jwt_bearer_grant(requests_mock: RequestsMocker, oauth2client: OAuth2Client, token_endpoint: str) -> None: - key = Jwk.generate_for_kty("EC", alg="ES256") + key = Jwk.generate(alg="ES256") assertion = Jwt.sign({"iat": 1661759343, "exp": 1661759403, "sub": "some_user_id"}, key) scope = "my_scope" @@ -1438,8 +1438,8 @@ class CustomBearerToken(BearerToken): def test_client_jwks() -> None: - private_key = Jwk.generate_for_alg(SignatureAlgs.RS256).with_kid_thumbprint() - id_token_decryption_key = Jwk.generate_for_alg(KeyManagementAlgs.ECDH_ES_A256KW).with_kid_thumbprint() + private_key = Jwk.generate(alg=SignatureAlgs.RS256).with_kid_thumbprint() + id_token_decryption_key = Jwk.generate(alg=KeyManagementAlgs.ECDH_ES_A256KW, crv="P-256").with_kid_thumbprint() client = OAuth2Client( authorization_endpoint="https://as.local/authorize", token_endpoint="https://as.local/token", @@ -1481,7 +1481,7 @@ def test_client_authorization_server_jwks() -> None: def test_client_id_token_decryption_key() -> None: - decryption_key = Jwk.generate(alg=KeyManagementAlgs.ECDH_ES_A256KW) + decryption_key = Jwk.generate(alg=KeyManagementAlgs.ECDH_ES_A256KW, crv="P-256") assert ( OAuth2Client( "https://as.local/token", client_id="client_id", id_token_decryption_key=decryption_key diff --git a/tests/unit_tests/test_oidc.py b/tests/unit_tests/test_oidc.py index a55e589..50d3d38 100644 --- a/tests/unit_tests/test_oidc.py +++ b/tests/unit_tests/test_oidc.py @@ -126,7 +126,7 @@ def test_invalid_id_token(token_endpoint: str) -> None: BearerToken(access_token="an_access_token", expires_in=60, id_token="foo") sig_jwk = Jwk.generate(alg=SignatureAlgs.RS256).with_kid_thumbprint() - enc_jwk = Jwk.generate(alg=KeyManagementAlgs.ECDH_ES_A256KW).with_kid_thumbprint() + enc_jwk = Jwk.generate(alg=KeyManagementAlgs.ECDH_ES_A256KW, crv="P-256").with_kid_thumbprint() as_jwks = sig_jwk.public_jwk().as_jwks() issuer = "http://issuer.local"