diff --git a/tests/test_email_handler.py b/tests/test_email_handler.py index d0030a33..f16faa8c 100644 --- a/tests/test_email_handler.py +++ b/tests/test_email_handler.py @@ -172,7 +172,7 @@ def generate_dmarc_result() -> List: @pytest.mark.parametrize("dmarc_result", generate_dmarc_result()) -def test_dmarc_reply_quarantine(dmarc_result: str): +def test_dmarc_reply_quarantine(flask_client, dmarc_result): user = create_random_user() alias = Alias.create_new_random(user) Session.commit() @@ -183,9 +183,8 @@ def test_dmarc_reply_quarantine(dmarc_result: str): name="Name {}".format(int(random.random())), reply_email="random-{}@{}".format(random.random(), EMAIL_DOMAIN), automatic_created=True, - flush=True, - commit=True, ) + Session.commit() msg = load_eml_file( "dmarc_reply_check.eml", { diff --git a/tests/utils.py b/tests/utils.py index 3621d9f5..3b4c7e56 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -39,11 +39,11 @@ def random_token(length: int = 10) -> str: def create_random_user() -> User: - email = "{}@{}.com".format(random_token(), random_token()) + random_email = "{}@{}.com".format(random_token(), random_token()) return User.create( - email=email, + email=random_email, password="password", - name="Test User", + name="Test {}".format(random_token()), activated=True, commit=True, )