diff options
author | kPherox <admin@mail.kr-kp.com> | 2019-10-01 01:39:22 +0900 |
---|---|---|
committer | kPherox <admin@mail.kr-kp.com> | 2019-10-01 01:40:33 +0900 |
commit | a0f101ee806af06bcd4271cd8d57d11ff85ea11a (patch) | |
tree | 2cd3c5d1a645be1395c57ec5616f31afb4b68da7 /test/daemons/digest_email_daemon_test.exs | |
parent | 8ca4f145a51e92c9f3a6c374ceddfac22ea300d9 (diff) | |
parent | 7c9b023a918c84b60ae6547289a083c671a3659b (diff) | |
download | pleroma-a0f101ee806af06bcd4271cd8d57d11ff85ea11a.tar.gz pleroma-a0f101ee806af06bcd4271cd8d57d11ff85ea11a.zip |
Merge remote-tracking branch 'upstream/develop' into fix-prameter-name-of-accounts-update-credentials
Diffstat (limited to 'test/daemons/digest_email_daemon_test.exs')
-rw-r--r-- | test/daemons/digest_email_daemon_test.exs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/daemons/digest_email_daemon_test.exs b/test/daemons/digest_email_daemon_test.exs new file mode 100644 index 000000000..3168f3b9a --- /dev/null +++ b/test/daemons/digest_email_daemon_test.exs @@ -0,0 +1,35 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.DigestEmailDaemonTest do + use Pleroma.DataCase + import Pleroma.Factory + + alias Pleroma.Daemons.DigestEmailDaemon + alias Pleroma.Tests.ObanHelpers + alias Pleroma.User + alias Pleroma.Web.CommonAPI + + test "it sends digest emails" do + user = insert(:user) + + date = + Timex.now() + |> Timex.shift(days: -10) + |> Timex.to_naive_datetime() + + user2 = insert(:user, last_digest_emailed_at: date) + User.switch_email_notifications(user2, "digest", true) + CommonAPI.post(user, %{"status" => "hey @#{user2.nickname}!"}) + + DigestEmailDaemon.perform() + ObanHelpers.perform_all() + # Performing job(s) enqueued at previous step + ObanHelpers.perform_all() + + assert_received {:email, email} + assert email.to == [{user2.name, user2.email}] + assert email.subject == "Your digest from #{Pleroma.Config.get(:instance)[:name]}" + end +end |