1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Emails.MailerTest do
7 alias Pleroma.Emails.Mailer
9 import Swoosh.TestAssertions
12 from: {"Pleroma", "noreply@example.com"},
13 html_body: "Test email",
14 subject: "Pleroma test email",
15 to: [{"Test User", "user1@example.com"}]
17 setup do: clear_config([Pleroma.Emails.Mailer, :enabled], true)
19 test "not send email when mailer is disabled" do
20 clear_config([Pleroma.Emails.Mailer, :enabled], false)
21 Mailer.deliver(@email)
25 from: {"Pleroma", "noreply@example.com"},
26 to: [{"Test User", "user1@example.com"}],
27 html_body: "Test email",
28 subject: "Pleroma test email"
33 Mailer.deliver(@email)
37 from: {"Pleroma", "noreply@example.com"},
38 to: [{"Test User", "user1@example.com"}],
39 html_body: "Test email",
40 subject: "Pleroma test email"
45 Mailer.perform(:deliver_async, @email, [])
49 from: {"Pleroma", "noreply@example.com"},
50 to: [{"Test User", "user1@example.com"}],
51 html_body: "Test email",
52 subject: "Pleroma test email"