1 defmodule Pleroma.Activity.PrunerTest do
2 use Pleroma.DataCase, async: true
5 alias Pleroma.Activity.Pruner
9 describe "prune_deletes" do
10 test "it prunes old delete objects" do
13 new_delete = insert(:delete_activity, type: "Delete", user: user)
16 insert(:delete_activity,
19 inserted_at: DateTime.utc_now() |> DateTime.add(-31 * 24, :hour)
22 Pruner.prune_deletes()
23 assert Activity.get_by_id(new_delete.id)
24 refute Activity.get_by_id(old_delete.id)
28 describe "prune_stale_follow_requests" do
29 test "it prunes old follow requests" do
30 follower = insert(:user)
31 followee = insert(:user)
41 old_not_rejected_request =
42 insert(:follow_activity,
46 inserted_at: DateTime.utc_now() |> DateTime.add(-31 * 24, :hour)
50 insert(:follow_activity,
53 inserted_at: DateTime.utc_now() |> DateTime.add(-31 * 24, :hour),
57 Pruner.prune_stale_follow_requests()
58 assert Activity.get_by_id(new_follow_request.id)
59 assert Activity.get_by_id(old_not_rejected_request.id)
60 refute Activity.get_by_id(old_follow_request.id)