summaryrefslogtreecommitdiff
path: root/test/emails
diff options
context:
space:
mode:
Diffstat (limited to 'test/emails')
-rw-r--r--test/emails/admin_email_test.exs22
-rw-r--r--test/emails/mailer_test.exs8
2 files changed, 26 insertions, 4 deletions
diff --git a/test/emails/admin_email_test.exs b/test/emails/admin_email_test.exs
index bc871a0a9..e24231e27 100644
--- a/test/emails/admin_email_test.exs
+++ b/test/emails/admin_email_test.exs
@@ -31,7 +31,7 @@ defmodule Pleroma.Emails.AdminEmailTest do
account_url
}\">#{account.nickname}</a></p>\n<p>Comment: Test comment\n<p> Statuses:\n <ul>\n <li><a href=\"#{
status_url
- }\">#{status_url}</li>\n </ul>\n</p>\n\n"
+ }\">#{status_url}</li>\n </ul>\n</p>\n\n<p>\n<a href=\"http://localhost:4001/pleroma/admin/#/reports/index\">View Reports in AdminFE</a>\n"
end
test "it works when the reporter is a remote user without email" do
@@ -46,4 +46,24 @@ defmodule Pleroma.Emails.AdminEmailTest do
assert res.to == [{to_user.name, to_user.email}]
assert res.from == {config[:name], config[:notify_email]}
end
+
+ test "new unapproved registration email" do
+ config = Pleroma.Config.get(:instance)
+ to_user = insert(:user)
+ account = insert(:user, registration_reason: "Plz let me in")
+
+ res = AdminEmail.new_unapproved_registration(to_user, account)
+
+ account_url = Helpers.user_feed_url(Pleroma.Web.Endpoint, :feed_redirect, account.id)
+
+ assert res.to == [{to_user.name, to_user.email}]
+ assert res.from == {config[:name], config[:notify_email]}
+ assert res.subject == "New account up for review on #{config[:name]} (@#{account.nickname})"
+
+ assert res.html_body == """
+ <p>New account for review: <a href="#{account_url}">@#{account.nickname}</a></p>
+ <blockquote>Plz let me in</blockquote>
+ <a href="http://localhost:4001/pleroma/admin">Visit AdminFE</a>
+ """
+ end
end
diff --git a/test/emails/mailer_test.exs b/test/emails/mailer_test.exs
index f30aa6a72..9e232d2a0 100644
--- a/test/emails/mailer_test.exs
+++ b/test/emails/mailer_test.exs
@@ -14,12 +14,12 @@ defmodule Pleroma.Emails.MailerTest do
subject: "Pleroma test email",
to: [{"Test User", "user1@example.com"}]
}
-
- clear_config([Pleroma.Emails.Mailer, :enabled])
+ setup do: clear_config([Pleroma.Emails.Mailer, :enabled], true)
test "not send email when mailer is disabled" do
- Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false)
+ clear_config([Pleroma.Emails.Mailer, :enabled], false)
Mailer.deliver(@email)
+ :timer.sleep(100)
refute_email_sent(
from: {"Pleroma", "noreply@example.com"},
@@ -31,6 +31,7 @@ defmodule Pleroma.Emails.MailerTest do
test "send email" do
Mailer.deliver(@email)
+ :timer.sleep(100)
assert_email_sent(
from: {"Pleroma", "noreply@example.com"},
@@ -42,6 +43,7 @@ defmodule Pleroma.Emails.MailerTest do
test "perform" do
Mailer.perform(:deliver_async, @email, [])
+ :timer.sleep(100)
assert_email_sent(
from: {"Pleroma", "noreply@example.com"},