1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 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"}]
19 value = Pleroma.Config.get([Pleroma.Emails.Mailer, :enabled])
20 on_exit(fn -> Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], value) end)
24 test "not send email when mailer is disabled" do
25 Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false)
26 Mailer.deliver(@email)
29 from: {"Pleroma", "noreply@example.com"},
30 to: [{"Test User", "user1@example.com"}],
31 html_body: "Test email",
32 subject: "Pleroma test email"
37 Mailer.deliver(@email)
40 from: {"Pleroma", "noreply@example.com"},
41 to: [{"Test User", "user1@example.com"}],
42 html_body: "Test email",
43 subject: "Pleroma test email"
48 Mailer.perform(:deliver_async, @email, [])
51 from: {"Pleroma", "noreply@example.com"},
52 to: [{"Test User", "user1@example.com"}],
53 html_body: "Test email",
54 subject: "Pleroma test email"