diff --git a/diracx-core/tests/test_secrets.py b/diracx-core/tests/test_secrets.py index d6b95ea5..1518af3d 100644 --- a/diracx-core/tests/test_secrets.py +++ b/diracx-core/tests/test_secrets.py @@ -9,7 +9,15 @@ def compare_keys(key1, key2): """Compare two keys by checking their public keys.""" - assert key1.public_key() == key2.public_key() + key1_public = key1.public_key().public_bytes( + encoding=serialization.Encoding.PEM, + format=serialization.PublicFormat.SubjectPublicKeyInfo, + ) + key2_public = key2.public_key().public_bytes( + encoding=serialization.Encoding.PEM, + format=serialization.PublicFormat.SubjectPublicKeyInfo, + ) + assert key1_public == key2_public def test_token_signing_key(tmp_path): diff --git a/diracx-core/tests/test_utils.py b/diracx-core/tests/test_utils.py index aebd55ad..e1e3f683 100644 --- a/diracx-core/tests/test_utils.py +++ b/diracx-core/tests/test_utils.py @@ -139,7 +139,7 @@ def test_read_credentials_missing_file(tmp_path): def test_write_credentials_unavailable_path(): """Test that write_credentials raises error when it can't create path.""" wrong_path = Path("/wrong/path/file.txt") - with pytest.raises(PermissionError): + with pytest.raises((PermissionError, OSError)): write_credentials(TokenResponse(**TOKEN_RESPONSE_DICT), location=wrong_path)