diff options
| author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-09-17 22:53:26 +0300 |
|---|---|---|
| committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-09-17 22:53:26 +0300 |
| commit | 01c1078015c1ddbaa195125034489a14233df206 (patch) | |
| tree | 01c63b7d6a8040decf6e0cd1630b715ca2cb29c6 /test/daemons/digest_email_daemon_test.exs | |
| parent | 76068873dbf9da191dd2487158ca88df198b811a (diff) | |
| parent | 79376abae347a5039931f57c581074b6da859827 (diff) | |
| download | pleroma-01c1078015c1ddbaa195125034489a14233df206.tar.gz pleroma-01c1078015c1ddbaa195125034489a14233df206.zip | |
[#1234] Merge remote-tracking branch 'remotes/upstream/develop' into 1234-mastodon-2-4-3-oauth-scopes
# Conflicts:
# lib/pleroma/web/activity_pub/activity_pub_controller.ex
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 |
