aboutsummaryrefslogtreecommitdiff
path: root/test/user_test.exs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-05-26 15:57:01 +0000
committerrinpatch <rinpatch@sdf.org>2020-05-26 15:57:01 +0000
commit3601c0015cd9537c75c476943d148a1063c237b8 (patch)
treee0842b37d9922ca7714a45100f3a640265fe5ccd /test/user_test.exs
parent5ad28ff405d0d5efc794e0e1f20091164ca82ea8 (diff)
parentf20dff451e7abf343906b4e74f5d47b6207a3580 (diff)
downloadpleroma-3601c0015cd9537c75c476943d148a1063c237b8.tar.gz
Merge branch '1808-pleroma-sucks' into 'develop'
Resolve "Don't fail message ingestions when we can't update a user" Closes #1808 See merge request pleroma/pleroma!2576
Diffstat (limited to 'test/user_test.exs')
-rw-r--r--test/user_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/user_test.exs b/test/user_test.exs
index 45125f704..3556ef1b4 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -586,6 +586,26 @@ defmodule Pleroma.UserTest do
refute user.last_refreshed_at == orig_user.last_refreshed_at
end
+
+ @tag capture_log: true
+ test "it returns the old user if stale, but unfetchable" do
+ a_week_ago = NaiveDateTime.add(NaiveDateTime.utc_now(), -604_800)
+
+ orig_user =
+ insert(
+ :user,
+ local: false,
+ nickname: "admin@mastodon.example.org",
+ ap_id: "http://mastodon.example.org/users/raymoo",
+ last_refreshed_at: a_week_ago
+ )
+
+ assert orig_user.last_refreshed_at == a_week_ago
+
+ {:ok, user} = User.get_or_fetch_by_ap_id("http://mastodon.example.org/users/raymoo")
+
+ assert user.last_refreshed_at == orig_user.last_refreshed_at
+ end
end
test "returns an ap_id for a user" do