aports/community/py3-python-jose/fix-test-ec.patch
mio 6a342b87cf community/py3-python-jose: fix test
Fix test with cryptography 46, previously a deprecation warning.

```
    @pytest.mark.cryptography
    @pytest.mark.skipif(CryptographyECKey is None, reason="pyca/cryptography backend not available")
    def test_incorrect_public_key_hmac_signing():
        def b64(x):
            return base64.urlsafe_b64encode(x).replace(b"=", b"")

>       KEY = CryptographyEc.generate_private_key(CryptographyEc.SECP256R1)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       TypeError: curve must be an EllipticCurve instance

tests/algorithms/test_EC.py:238: TypeError
```
2025-11-05 21:51:56 +00:00

28 lines
1.1 KiB
Diff

Patch-Source: https://github.com/mpdavis/python-jose/pull/393
---
From 7c0e4c6640bdc9cd60ac66d96d5d90f4377873db Mon Sep 17 00:00:00 2001
From: dotlambda <github@dotlambda.de>
Date: Tue, 21 Oct 2025 20:29:01 -0700
Subject: [PATCH] fix test_incorrect_public_key_hmac_signing
It used to fail with
TypeError: curve must be an EllipticCurve instance
---
tests/algorithms/test_EC.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/algorithms/test_EC.py b/tests/algorithms/test_EC.py
index d8602a2..39f4073 100644
--- a/tests/algorithms/test_EC.py
+++ b/tests/algorithms/test_EC.py
@@ -235,7 +235,7 @@ def test_incorrect_public_key_hmac_signing():
def b64(x):
return base64.urlsafe_b64encode(x).replace(b"=", b"")
- KEY = CryptographyEc.generate_private_key(CryptographyEc.SECP256R1)
+ KEY = CryptographyEc.generate_private_key(CryptographyEc.SECP256R1(), CryptographyEc.SECP256R1)
PUBKEY = KEY.public_key().public_bytes(
encoding=serialization.Encoding.OpenSSH,
format=serialization.PublicFormat.OpenSSH,