Fix test
authorEgor Kislitsyn <egor@kislitsyn.com>
Wed, 23 Sep 2020 16:23:11 +0000 (20:23 +0400)
committerEgor Kislitsyn <egor@kislitsyn.com>
Wed, 7 Oct 2020 14:35:28 +0000 (18:35 +0400)
test/backup_test.exs
test/web/admin_api/controllers/admin_api_controller_test.exs

index 0ea40e6fd83df3b5179a26f0ced6d6b925b2e874..23c08b680397524debb21e55af2dd6508b793d6a 100644 (file)
@@ -67,7 +67,12 @@ defmodule Pleroma.BackupTest do
     assert {:ok, backup} = perform_job(BackupWorker, delete_job_args)
     refute Backup.get(backup_id)
 
-    assert_email_sent(Pleroma.Emails.UserEmail.backup_is_ready_email(backup))
+    email = Pleroma.Emails.UserEmail.backup_is_ready_email(backup)
+
+    assert_email_sent(
+      to: {user.name, user.email},
+      html_body: email.html_body
+    )
   end
 
   test "it removes outdated backups after creating a fresh one" do
index 4b3abce0dfd46af0a4eb11f9f520e4acb628ac0e..a6dc4f62d3a08f5ea179963d5f59eabe42a97736 100644 (file)
@@ -2042,7 +2042,10 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
 
       ObanHelpers.perform_all()
 
-      assert_email_sent(Pleroma.Emails.UserEmail.backup_is_ready_email(backup, admin.id))
+      email = Pleroma.Emails.UserEmail.backup_is_ready_email(backup, admin.id)
+
+      assert String.contains?(email.html_body, "Admin @#{admin.nickname} requested a full backup")
+      assert_email_sent(to: {user.name, user.email}, html_body: email.html_body)
     end
 
     test "it doesn't limit admins", %{conn: conn} do