app-MAIL-temp/tests/dashboard/test_custom_alias.py

27 lines
646 B
Python
Raw Normal View History

2020-02-05 11:35:38 +01:00
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):
2020-02-10 17:30:04 +01:00
user = login(flask_client)
2020-02-05 11:35:38 +01:00
db.session.commit()
word = random_word()
r = flask_client.post(
url_for("dashboard.custom_alias"),
2020-02-10 17:30:04 +01:00
data={
"prefix": "prefix",
"suffix": f".{word}@{EMAIL_DOMAIN}",
"mailbox": user.email,
},
2020-02-05 11:35:38 +01:00
follow_redirects=True,
)
assert r.status_code == 200
assert f"Alias prefix.{word}@{EMAIL_DOMAIN} has been created" in str(r.data)