diff options
| author | Mark Felder <feld@FreeBSD.org> | 2020-09-10 16:02:11 -0500 |
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2020-09-10 16:05:22 -0500 |
| commit | 55562ca9362d66553ea3638c91174bbeb6c637f1 (patch) | |
| tree | bb0b57d0a40dec779b0bfbfcbf65f3b9d3bea2b3 /test/emails | |
| parent | 39f7fc5b8ef781c98136d1f9be50a14bff394233 (diff) | |
| parent | 6316350918d1f55167fa384d55f385ff2c93e6bb (diff) | |
| download | pleroma-55562ca9362d66553ea3638c91174bbeb6c637f1.tar.gz pleroma-55562ca9362d66553ea3638c91174bbeb6c637f1.zip | |
Merge branch 'develop' into feature/gen-magic
Diffstat (limited to 'test/emails')
| -rw-r--r-- | test/emails/admin_email_test.exs | 22 | ||||
| -rw-r--r-- | test/emails/mailer_test.exs | 7 |
2 files changed, 26 insertions, 3 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 e6e34cba8..9e232d2a0 100644 --- a/test/emails/mailer_test.exs +++ b/test/emails/mailer_test.exs @@ -14,11 +14,12 @@ defmodule Pleroma.Emails.MailerTest do subject: "Pleroma test email", to: [{"Test User", "user1@example.com"}] } - setup do: 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"}, @@ -30,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"}, @@ -41,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"}, |
