1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 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])
19 test "not send email when mailer is disabled" do
20 Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false)
21 Mailer.deliver(@email)
24 from: {"Pleroma", "noreply@example.com"},
25 to: [{"Test User", "user1@example.com"}],
26 html_body: "Test email",
27 subject: "Pleroma test email"
32 Mailer.deliver(@email)
35 from: {"Pleroma", "noreply@example.com"},
36 to: [{"Test User", "user1@example.com"}],
37 html_body: "Test email",
38 subject: "Pleroma test email"
43 Mailer.perform(:deliver_async, @email, [])
46 from: {"Pleroma", "noreply@example.com"},
47 to: [{"Test User", "user1@example.com"}],
48 html_body: "Test email",
49 subject: "Pleroma test email"