1 defmodule Mix.Tasks.Pleroma.DigestTest do
5 import Swoosh.TestAssertions
7 alias Pleroma.Tests.ObanHelpers
8 alias Pleroma.Web.CommonAPI
11 Mix.shell(Mix.Shell.Process)
14 Mix.shell(Mix.Shell.IO)
20 describe "pleroma.digest test" do
21 test "Sends digest to the given user" do
25 Enum.each(0..10, fn i ->
27 CommonAPI.post(user1, %{
28 "status" => "hey ##{i} @#{user2.nickname}!"
34 NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second),
39 {:ok, yesterday_date} = Timex.format(yesterday, "%F", :strftime)
41 :ok = Mix.Tasks.Pleroma.Digest.run(["test", user2.nickname, yesterday_date])
43 ObanHelpers.perform_all()
45 assert_receive {:mix_shell, :info, [message]}
46 assert message =~ "Digest email have been sent"
49 to: {user2.name, user2.email},
50 html_body: ~r/here is what you've missed!/i