1 defmodule Mix.Tasks.Pleroma.DigestTest do
5 import Swoosh.TestAssertions
7 alias Pleroma.Web.CommonAPI
10 Mix.shell(Mix.Shell.Process)
13 Mix.shell(Mix.Shell.IO)
19 describe "pleroma.digest test" do
20 test "Sends digest to the given user" do
24 Enum.each(0..10, fn i ->
26 CommonAPI.post(user1, %{
27 "status" => "hey ##{i} @#{user2.nickname}!"
33 NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second),
38 {:ok, yesterday_date} = Timex.format(yesterday, "%F", :strftime)
40 :ok = Mix.Tasks.Pleroma.Digest.run(["test", user2.nickname, yesterday_date])
42 assert_receive {:mix_shell, :info, [message]}
43 assert message =~ "Digest email have been sent"
46 to: {user2.name, user2.email},
47 html_body: ~r/here is what you've missed!/i