This commit is contained in:
2023-11-22 12:00:09 +00:00
parent 5776128905
commit 1081400948
50 changed files with 223 additions and 94 deletions

View File

@ -58,7 +58,7 @@ def test_different_scenarios_v4_2(flask_client):
assert r.json["suffixes"]
assert r.json["prefix_suggestion"] == "" # no hostname => no suggestion
for (suffix, signed_suffix) in r.json["suffixes"]:
for suffix, signed_suffix in r.json["suffixes"]:
assert signed_suffix.startswith(suffix)
# <<< with hostname >>>

View File

@ -56,13 +56,15 @@ def test_get_jobs_to_run(flask_client):
run_at=now.shift(hours=3),
)
# Job out of attempts
Job.create(
name="",
payload="",
state=JobState.taken.value,
taken_at=now.shift(minutes=-(config.JOB_TAKEN_RETRY_WAIT_MINS + 10)),
attempts=config.JOB_MAX_ATTEMPTS + 1,
),
(
Job.create(
name="",
payload="",
state=JobState.taken.value,
taken_at=now.shift(minutes=-(config.JOB_TAKEN_RETRY_WAIT_MINS + 10)),
attempts=config.JOB_MAX_ATTEMPTS + 1,
),
)
Session.commit()
jobs = get_jobs_to_run()
assert len(jobs) == len(expected_jobs_to_run)

View File

@ -7,7 +7,7 @@ import arrow
import pytest
from app import config
from app.config import MAX_ALERT_24H, EMAIL_DOMAIN, ROOT_DIR
from app.config import MAX_ALERT_24H, ROOT_DIR
from app.db import Session
from app.email_utils import (
get_email_domain_part,
@ -16,7 +16,6 @@ from app.email_utils import (
delete_header,
add_or_replace_header,
send_email_with_rate_control,
copy,
get_spam_from_header,
get_header_from_bounce,
add_header,

View File

@ -17,7 +17,7 @@ def test_encode_decode(flask_client):
jwt_token = make_id_token(client_user)
assert type(jwt_token) is str
assert isinstance(jwt_token, str)
assert verify_id_token(jwt_token)

View File

@ -49,9 +49,9 @@ def encrypt_decrypt_text(text: str):
priv = pgpy.PGPKey()
priv.parse(private_key)
decrypted = priv.decrypt(encrypted).message
if type(decrypted) == str:
if isinstance(decrypted, str):
assert decrypted == text
elif type(decrypted) == bytearray:
elif isinstance(decrypted, bytearray):
assert decrypted.decode() == text