aboutsummaryrefslogtreecommitdiff
path: root/test/notification_test.exs
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-04-02 14:47:17 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-04-02 14:47:17 +0300
commitdbcfac11b45b367185a3b18a2db3e3fb07e8f20d (patch)
tree039254a94616f04f4ea00e893bf0fb66dc06d9e8 /test/notification_test.exs
parentdfd2c741849e9afaf35e3ddbecbb50feb47f5d22 (diff)
parentfd932b14a7e7335a91a2acc2d6dd6fba7e2e90b3 (diff)
downloadpleroma-dbcfac11b45b367185a3b18a2db3e3fb07e8f20d.tar.gz
Merge branch 'develop' into issue/1276
Diffstat (limited to 'test/notification_test.exs')
-rw-r--r--test/notification_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs
index ba1318f33..c3d70c51f 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -797,12 +797,20 @@ defmodule Pleroma.NotificationTest do
"object" => remote_user.ap_id
}
+ remote_user_url = remote_user.ap_id
+
+ Tesla.Mock.mock(fn
+ %{method: :get, url: ^remote_user_url} ->
+ %Tesla.Env{status: 404, body: ""}
+ end)
+
{:ok, _delete_activity} = Transmogrifier.handle_incoming(delete_user_message)
ObanHelpers.perform_all()
assert Enum.empty?(Notification.for_user(local_user))
end
+ @tag capture_log: true
test "move activity generates a notification" do
%{ap_id: old_ap_id} = old_user = insert(:user)
%{ap_id: new_ap_id} = new_user = insert(:user, also_known_as: [old_ap_id])
@@ -812,6 +820,18 @@ defmodule Pleroma.NotificationTest do
User.follow(follower, old_user)
User.follow(other_follower, old_user)
+ old_user_url = old_user.ap_id
+
+ body =
+ File.read!("test/fixtures/users_mock/localhost.json")
+ |> String.replace("{{nickname}}", old_user.nickname)
+ |> Jason.encode!()
+
+ Tesla.Mock.mock(fn
+ %{method: :get, url: ^old_user_url} ->
+ %Tesla.Env{status: 200, body: body}
+ end)
+
Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
ObanHelpers.perform_all()