mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-05 16:13:12 +00:00
36012ef6c1
If we didn't put some kind of lifetime requirement on these, I guess you could annoy people by sending large numbers of ephemeral posts that provoke notifications but then disappear before anyone can read them.
28 lines
913 B
Elixir
28 lines
913 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2019 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.ActivityExpirationTest do
|
|
use Pleroma.DataCase
|
|
alias Pleroma.ActivityExpiration
|
|
import Pleroma.Factory
|
|
|
|
test "finds activities due to be deleted only" do
|
|
activity = insert(:note_activity)
|
|
expiration_due = insert(:expiration_in_the_past, %{activity_id: activity.id})
|
|
activity2 = insert(:note_activity)
|
|
insert(:expiration_in_the_future, %{activity_id: activity2.id})
|
|
|
|
expirations = ActivityExpiration.due_expirations()
|
|
|
|
assert length(expirations) == 1
|
|
assert hd(expirations) == expiration_due
|
|
end
|
|
|
|
test "denies expirations that don't live long enough" do
|
|
activity = insert(:note_activity)
|
|
now = NaiveDateTime.utc_now()
|
|
assert {:error, _} = ActivityExpiration.create(activity, now)
|
|
end
|
|
end
|