Updated tests to match the formatting work done in the admin repo

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
Carlo Costino
2024-05-17 17:14:46 -04:00
parent ac4ebacfeb
commit aafa7178f9
30 changed files with 553 additions and 499 deletions

View File

@@ -1,7 +1,7 @@
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 +19,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 +31,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