X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fworkers%2Fcron%2Fnew_users_digest_worker_test.exs;h=e6d050ecc2b24d14b77eeda8b4439e6620c8f534;hb=7f692343c80ddf353712490edfbcdb14866f5685;hp=7892a780926c9a02c3789e85e7271cb864353477;hpb=df0b8f1d0802a2536bf436ff8157918929a183cc;p=akkoma
diff --git a/test/workers/cron/new_users_digest_worker_test.exs b/test/workers/cron/new_users_digest_worker_test.exs
index 7892a7809..e6d050ecc 100644
--- a/test/workers/cron/new_users_digest_worker_test.exs
+++ b/test/workers/cron/new_users_digest_worker_test.exs
@@ -1,14 +1,14 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do
use Pleroma.DataCase
import Pleroma.Factory
- alias Pleroma.Workers.NewUsersDigestWorker
alias Pleroma.Tests.ObanHelpers
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Workers.Cron.NewUsersDigestWorker
test "it sends new users digest emails" do
yesterday = NaiveDateTime.utc_now() |> Timex.shift(days: -1)
@@ -29,4 +29,16 @@ defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do
assert email.html_body =~ user2.nickname
assert email.html_body =~ "cofe"
end
+
+ test "it doesn't fail when admin has no email" do
+ yesterday = NaiveDateTime.utc_now() |> Timex.shift(days: -1)
+ insert(:user, %{is_admin: true, email: nil})
+ insert(:user, %{inserted_at: yesterday})
+ user = insert(:user, %{inserted_at: yesterday})
+
+ CommonAPI.post(user, %{"status" => "cofe"})
+
+ NewUsersDigestWorker.perform(nil, nil)
+ ObanHelpers.perform_all()
+ end
end