summaryrefslogtreecommitdiff
path: root/tests/test_api_jws.py
diff options
context:
space:
mode:
authorViicos <65306057+Viicos@users.noreply.github.com>2023-03-07 03:22:39 +0100
committerGitHub <noreply@github.com>2023-03-06 21:22:39 -0500
commit777efa2f51249f63b0f95804230117723eca5d09 (patch)
treef8d7db72d0806380daa91b37edde3c27c32eedea /tests/test_api_jws.py
parent5a2a6b640d9780c75817a626672da0b2d38f9e78 (diff)
downloadpyjwt-777efa2f51249f63b0f95804230117723eca5d09.tar.gz
Make `Algorithm` an abstract base class (#845)
* Make `Algorithm` an abstract base class This also removes some tests that are not relevant anymore Raise `NotImplementedError` for `NoneAlgorithm` * Use `hasattr` instead of `getattr` * Only allow `dict` in `encode`
Diffstat (limited to 'tests/test_api_jws.py')
-rw-r--r--tests/test_api_jws.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test_api_jws.py b/tests/test_api_jws.py
index 2929215..d2aa915 100644
--- a/tests/test_api_jws.py
+++ b/tests/test_api_jws.py
@@ -3,7 +3,7 @@ from decimal import Decimal
import pytest
-from jwt.algorithms import Algorithm, has_crypto
+from jwt.algorithms import NoneAlgorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
@@ -39,10 +39,10 @@ def payload():
class TestJWS:
def test_register_algo_does_not_allow_duplicate_registration(self, jws):
- jws.register_algorithm("AAA", Algorithm())
+ jws.register_algorithm("AAA", NoneAlgorithm())
with pytest.raises(ValueError):
- jws.register_algorithm("AAA", Algorithm())
+ jws.register_algorithm("AAA", NoneAlgorithm())
def test_register_algo_rejects_non_algorithm_obj(self, jws):
with pytest.raises(TypeError):