========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= test session starts ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
platform linux -- Python 3.10.12, pytest-9.0.3, pluggy-1.6.0
rootdir: /workspace/pyjwt
configfile: tox.ini
plugins: anyio-4.13.0, metadata-3.1.1, json-report-1.5.0, cov-7.1.0
collected 262 items

tests/test_advisory.py .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         [  0%]
tests/test_algorithms.py .............................................F...............................                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           [ 29%]
tests/test_api_jwk.py ............s......                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [ 37%]
tests/test_api_jws.py ................F.................s.........F.....................F..FF                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [ 64%]
tests/test_api_jwt.py ...........................................................                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [ 86%]
tests/test_compressed_jwt.py .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   [ 87%]
tests/test_exceptions.py .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       [ 87%]
tests/test_jwks_client.py ....................                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   [ 95%]
tests/test_jwt.py .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [ 95%]
tests/test_utils.py .....x......                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 [100%]

=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== FAILURES ===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ TestAlgorithms.test_ec_should_reject_non_string_key __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

self = <tests.test_algorithms.TestAlgorithms object at 0x788e12a3a920>

    @crypto_required
    def test_ec_should_reject_non_string_key(self):
        algo = ECAlgorithm(ECAlgorithm.SHA256)

        with pytest.raises(TypeError):
>           algo.prepare_key(None)  # type: ignore[arg-type]

tests/test_algorithms.py:574:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <jwt.algorithms.ECAlgorithm object at 0x788e129de5f0>, key = None

    def prepare_key(self, key: Any):
        key = _load_key(key)
        if isinstance(key, (EllipticCurvePrivateKey, EllipticCurvePublicKey)):
            return key
>       raise InvalidKeyError('Expecting an EllipticCurvePrivateKey/EllipticCurvePublicKey.')
E       jwt.exceptions.InvalidKeyError: Expecting an EllipticCurvePrivateKey/Ellip<response clipped><NOTE>Due to the max output limit, only part of the full response has been shown to you.</NOTE>

self = <jwt.api_jws.PyJWS object at 0x788e123fdff0>, signing_input = b'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.', header = {'alg': 'HS256', 'typ': 'JWT'}, signature = b'H\x8a\xf4\xdf3:\xe1\xac\x16E\xd3\xeb\x00\xcf\xfa\xd5\x05\xace\xc8@\xb6\x00\xd5\xde\x9aa|s\xcfZB', key = 'secret', algorithms = ['HS256']

    def _verify_signature(self, signing_input: bytes, header: dict[str, Any], signature: bytes, key: Any='', algorithms: list[str] | None=None) -> None:
        if algorithms is None:
            raise DecodeError('It is required that you pass in a value for the "algorithms" argument when calling decode().')
        try:
            alg = header['alg']
        except KeyError as exc:
            raise InvalidAlgorithmError('Algorithm not specified') from exc
        if alg not in algorithms:
            raise InvalidAlgorithmError('The specified alg value is not allowed')
        try:
            alg_obj = self.get_algorithm_by_name(alg)
        except NotImplementedError as exc:
            raise InvalidAlgorithmError(str(exc)) from exc
        prepared_key = alg_obj.prepare_key(key)
        if not alg_obj.verify(signing_input, prepared_key, signature):
>           raise InvalidSignatureError('Signature verification failed')
E           jwt.exceptions.InvalidSignatureError: Signature verification failed

jwt/api_jws.py:147: InvalidSignatureError
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ TestJWS.test_decode_warns_on_unsupported_kwarg ____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

self = <tests.test_api_jws.TestJWS object at 0x788e12a0dde0>, jws = <jwt.api_jws.PyJWS object at 0x788e12a31cc0>, payload = b'hello world'

    def test_decode_warns_on_unsupported_kwarg(self, jws, payload):
        secret = "secret"
        jws_message = jws.encode(
            payload, secret, algorithm="HS256", is_payload_detached=True
        )

        with pytest.warns(RemovedInPyjwt3Warning) as record:
>           jws.decode(
                jws_message,
                secret,
                algorithms=["HS256"],
                detached_payload=payload,
                foo="bar",
            )

tests/test_api_jws.py:792:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jwt/api_jws.py:129: in decode
    decoded = self.decode_complete(jwt, key, algorithms, options, detached_payload=detached_payload, **kwargs)
jwt/api_jws.py:125: in decode_complete
    self._verify_signature(signing_input, header, signature, key, algorithms)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <jwt.api_jws.PyJWS object at 0x788e12a31cc0>, signing_input = b'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.', header = {'alg': 'HS256', 'typ': 'JWT'}, signature = b'H\x8a\xf4\xdf3:\xe1\xac\x16E\xd3\xeb\x00\xcf\xfa\xd5\x05\xace\xc8@\xb6\x00\xd5\xde\x9aa|s\xcfZB', key = 'secret', algorithms = ['HS256']

    def _verify_signature(self, signing_input: bytes, header: dict[str, Any], signature: bytes, key: Any='', algorithms: list[str] | None=None) -> None:
        if algorithms is None:
            raise DecodeError('It is required that you pass in a value for the "algorithms" argument when calling decode().')
        try:
            alg = header['alg']
        except KeyError as exc:
            raise InvalidAlgorithmError('Algorithm not specified') from exc
        if alg not in algorithms:
            raise InvalidAlgorithmError('The specified alg value is not allowed')
        try:
            alg_obj = self.get_algorithm_by_name(alg)
        except NotImplementedError as exc:
            raise InvalidAlgorithmError(str(exc)) from exc
        prepared_key = alg_obj.prepare_key(key)
        if not alg_obj.verify(signing_input, prepared_key, signature):
>           raise InvalidSignatureError('Signature verification failed')
E           jwt.exceptions.InvalidSignatureError: Signature verification failed

jwt/api_jws.py:147: InvalidSignatureError
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ TestJWS.test_decode_complete_warns_on_unuspported_kwarg ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

self = <tests.test_api_jws.TestJWS object at 0x788e12a0e560>, jws = <jwt.api_jws.PyJWS object at 0x788e12a31540>, payload = b'hello world'

    def test_decode_complete_warns_on_unuspported_kwarg(self, jws, payload):
        secret = "secret"
        jws_message = jws.encode(
            payload, secret, algorithm="HS256", is_payload_detached=True
        )

        with pytest.warns(RemovedInPyjwt3Warning) as record:
>           jws.decode_complete(
                jws_message,
                secret,
                algorithms=["HS256"],
                detached_payload=payload,
                foo="bar",
            )

tests/test_api_jws.py:809:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _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_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <jwt.api_jws.PyJWS object at 0x788e12a31540>, signing_input = b'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.', header = {'alg': 'HS256', 'typ': 'JWT'}, signature = b'H\x8a\xf4\xdf3:\xe1\xac\x16E\xd3\xeb\x00\xcf\xfa\xd5\x05\xace\xc8@\xb6\x00\xd5\xde\x9aa|s\xcfZB', key = 'secret', algorithms = ['HS256']

    def _verify_signature(self, signing_input: bytes, header: dict[str, Any], signature: bytes, key: Any='', algorithms: list[str] | None=None) -> None:
        if algorithms is None:
            raise DecodeError('It is required that you pass in a value for the "algorithms" argument when calling decode().')
        try:
            alg = header['alg']
        except KeyError as exc:
            raise InvalidAlgorithmError('Algorithm not specified') from exc
        if alg not in algorithms:
            raise InvalidAlgorithmError('The specified alg value is not allowed')
        try:
            alg_obj = self.get_algorithm_by_name(alg)
        except NotImplementedError as exc:
            raise InvalidAlgorithmError(str(exc)) from exc
        prepared_key = alg_obj.prepare_key(key)
        if not alg_obj.verify(signing_input, prepared_key, signature):
>           raise InvalidSignatureError('Signature verification failed')
E           jwt.exceptions.InvalidSignatureError: Signature verification failed

jwt/api_jws.py:147: InvalidSignatureError
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= short test summary info ========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
SKIPPED [1] tests/test_api_jwk.py:200: Requires cryptography library not installed
SKIPPED [1] tests/test_api_jws.py:387: Requires cryptography library not installed
XFAIL tests/test_utils.py::test_to_base64url_uint[-1-]
FAILED tests/test_algorithms.py::TestAlgorithms::test_ec_should_reject_non_string_key - jwt.exceptions.InvalidKeyError: Expecting an EllipticCurvePrivateKey/EllipticCurvePublicKey.
FAILED tests/test_api_jws.py::TestJWS::test_encode_with_headers_alg_none - jwt.exceptions.InvalidKeyError: When alg = "none", key value must be None.
FAILED tests/test_api_jws.py::TestJWS::test_decode_with_algo_none_should_fail - jwt.exceptions.InvalidKeyError: When alg = "none", key value must be None.
FAILED tests/test_api_jws.py::TestJWS::test_encode_decode_with_detached_content - jwt.exceptions.InvalidSignatureError: Signature verification failed
FAILED tests/test_api_jws.py::TestJWS::test_decode_warns_on_unsupported_kwarg - jwt.exceptions.InvalidSignatureError: Signature verification failed
FAILED tests/test_api_jws.py::TestJWS::test_decode_complete_warns_on_unuspported_kwarg - jwt.exceptions.InvalidSignatureError: Signature verification failed
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= 6 failed, 253 passed, 2 skipped, 1 xfailed in 5.55s ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
[The command completed with exit code 1.]
[Current working directory: /workspace/pyjwt]
[Python interpreter: /usr/bin/python]
[Command finished with exit code 1]