more fixes

This commit is contained in:
Kenneth Kehl
2024-05-17 08:52:23 -07:00
parent dcfc78d805
commit 7302e4c811
9 changed files with 372 additions and 347 deletions

View File

@@ -1,7 +1,6 @@
import urllib
import pytest
from itsdangerous import BadSignature, SignatureExpired
from pytest import fail
from notifications_utils.url_safe_token import check_token, generate_token
@@ -19,7 +18,7 @@ def test_should_throw_exception_when_token_is_tampered_with():
token = generate_token(str(uuid.uuid4()), "secret-key", "dangerous-salt")
try:
check_token(token + "qerqwer", "secret-key", "dangerous-salt", 30)
fail()
pytest.fail("Expected a BadSignature")
except BadSignature:
pass
@@ -31,6 +30,6 @@ def test_return_none_when_token_is_expired():
token = urllib.parse.unquote(token)
try:
assert check_token(token, "secret-key", "dangerous-salt", max_age) is None
fail("Expected a SignatureExpired exception")
pytest.fail("Expected a SignatureExpired exception")
except SignatureExpired:
pass