aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Verdone <spiral@arcseconds.net>2019-07-23 16:33:45 +0200
committerMike Verdone <spiral@arcseconds.net>2019-07-24 14:46:08 +0200
commit36012ef6c1dfea2489e61063e14783fa3fb52700 (patch)
treed0acbe24ee235d8e841d4c9cd3a3951483ae7b0a /test
parent704960b3c135d2e050308c68f5ccf5d7b7df40f8 (diff)
downloadpleroma-36012ef6c1dfea2489e61063e14783fa3fb52700.tar.gz
Require that ephemeral posts live for at least one hour
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.
Diffstat (limited to 'test')
-rw-r--r--test/activity_expiration_test.exs6
-rw-r--r--test/support/factory.ex2
2 files changed, 7 insertions, 1 deletions
diff --git a/test/activity_expiration_test.exs b/test/activity_expiration_test.exs
index 20566a186..4948fae16 100644
--- a/test/activity_expiration_test.exs
+++ b/test/activity_expiration_test.exs
@@ -18,4 +18,10 @@ defmodule Pleroma.ActivityExpirationTest do
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
diff --git a/test/support/factory.ex b/test/support/factory.ex
index 63fe3a66d..7a2ddcada 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -158,7 +158,7 @@ defmodule Pleroma.Factory do
end
def expiration_in_the_future_factory(attrs \\ %{}) do
- expiration_offset_by_minutes(attrs, 60)
+ expiration_offset_by_minutes(attrs, 61)
end
def article_activity_factory do