1 defmodule Mix.Tasks.Pleroma.EmailTest do
4 import Swoosh.TestAssertions
7 alias Pleroma.Tests.ObanHelpers
10 Mix.shell(Mix.Shell.Process)
13 Mix.shell(Mix.Shell.IO)
19 describe "pleroma.email test" do
20 test "Sends test email with no given address" do
21 mail_to = Config.get([:instance, :email])
23 :ok = Mix.Tasks.Pleroma.Email.run(["test"])
25 ObanHelpers.perform_all()
27 assert_receive {:mix_shell, :info, [message]}
28 assert message =~ "Test email has been sent"
32 html_body: ~r/a test email was requested./i
36 test "Sends test email with given address" do
37 mail_to = "hewwo@example.com"
39 :ok = Mix.Tasks.Pleroma.Email.run(["test", "--to", mail_to])
41 ObanHelpers.perform_all()
43 assert_receive {:mix_shell, :info, [message]}
44 assert message =~ "Test email has been sent"
48 html_body: ~r/a test email was requested./i