X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=inline;f=test%2Fpleroma%2Femails%2Fuser_email_test.exs;h=56455200463475e6c3e2833a1df7a1c2ab941b72;hb=d2b0d864718c676af9909ee45fac60d5f232bf6a;hp=a75623bb41aa3c72cd3a532e6db38c3ce2545d68;hpb=049ece1ef38f1aeb656a88ed1d15bf3d4a364e01;p=akkoma
diff --git a/test/pleroma/emails/user_email_test.exs b/test/pleroma/emails/user_email_test.exs
index a75623bb4..564552004 100644
--- a/test/pleroma/emails/user_email_test.exs
+++ b/test/pleroma/emails/user_email_test.exs
@@ -1,9 +1,9 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emails.UserEmailTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Emails.UserEmail
alias Pleroma.Web.Endpoint
@@ -27,7 +27,7 @@ defmodule Pleroma.Emails.UserEmailTest do
token = %Pleroma.UserInviteToken{token: "test-token"}
email = UserEmail.user_invitation_email(user, token, "test@test.com", "Jonh")
assert email.from == {config[:name], config[:notify_email]}
- assert email.subject == "Invitation to Pleroma"
+ assert email.subject == "Invitation to Akkoma"
assert email.to == [{"Jonh", "test@test.com"}]
assert email.html_body =~
@@ -45,4 +45,27 @@ defmodule Pleroma.Emails.UserEmailTest do
assert email.html_body =~
Router.Helpers.confirm_email_url(Endpoint, :confirm_email, user.id, "conf-token")
end
+
+ test "build approval pending email" do
+ config = Pleroma.Config.get(:instance)
+ user = insert(:user)
+ email = UserEmail.approval_pending_email(user)
+
+ assert email.from == {config[:name], config[:notify_email]}
+ assert email.to == [{user.name, user.email}]
+ assert email.subject == "Your account is awaiting approval"
+ assert email.html_body =~ "Awaiting Approval"
+ end
+
+ test "email i18n" do
+ user = insert(:user, language: "en_test")
+ email = UserEmail.approval_pending_email(user)
+ assert email.subject == "xxYour account is awaiting approvalxx"
+ end
+
+ test "email i18n should fallback to default locale if user language is unsupported" do
+ user = insert(:user, language: "unsupported")
+ email = UserEmail.approval_pending_email(user)
+ assert email.subject == "Your account is awaiting approval"
+ end
end