From d8229102a6be5b868d5c7a48bcfdec31126bc4c6 Mon Sep 17 00:00:00 2001 From: Son NK Date: Wed, 5 Feb 2020 17:35:38 +0700 Subject: [PATCH] add test for custom alias page --- tests/dashboard/test_custom_alias.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/dashboard/test_custom_alias.py diff --git a/tests/dashboard/test_custom_alias.py b/tests/dashboard/test_custom_alias.py new file mode 100644 index 00000000..cb3ad09f --- /dev/null +++ b/tests/dashboard/test_custom_alias.py @@ -0,0 +1,22 @@ +from flask import url_for + +from app.config import EMAIL_DOMAIN +from app.extensions import db +from app.utils import random_word +from tests.utils import login + + +def test_add_alias_success(flask_client): + login(flask_client) + db.session.commit() + + word = random_word() + + r = flask_client.post( + url_for("dashboard.custom_alias"), + data={"prefix": "prefix", "suffix": f".{word}@{EMAIL_DOMAIN}"}, + follow_redirects=True, + ) + + assert r.status_code == 200 + assert f"Alias prefix.{word}@{EMAIL_DOMAIN} has been created" in str(r.data)