Skip to content

Commit

Permalink
tests: add a test that sends a mail without SERVER_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Dec 14, 2023
1 parent 3137e72 commit 7a2d7ca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/app/test_mails.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ def test_default_from_addr(testclient, user, smtpd):
assert smtpd.messages[0]["From"] == '"Canaille" <admin@localhost>'


def test_default_with_no_flask_server_name(configuration, user, smtpd, backend):
del configuration["SERVER_NAME"]
del configuration["SMTP"]["FROM_ADDR"]
app = create_app(configuration, backend=backend)

testclient = TestApp(app)
res = testclient.get("/reset", status=200)
res.form["login"] = "user"
res = res.form.submit(status=200)
assert smtpd.messages[0]["X-MailFrom"] == "admin@localhost"
assert smtpd.messages[0]["From"] == '"Canaille" <admin@localhost>'


def test_default_from_flask_server_name(configuration, user, smtpd, backend):
app = create_app(configuration, backend=backend)
del app.config["SMTP"]["FROM_ADDR"]
Expand Down

0 comments on commit 7a2d7ca

Please sign in to comment.