summaryrefslogtreecommitdiff
path: root/test/notification_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-04-01 20:08:14 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-04-01 20:08:14 +0300
commit98b96e45ababecb7554232787968f2f326f24e54 (patch)
tree66e907ccc1acd2c667b57f5b5d0a8db34cbd288c /test/notification_test.exs
parent2f2bd7fe72f474b7177c751a2dc3af716622ba91 (diff)
parentef7d2b0f11a9bf74e982b73ae4cec632f93fbebc (diff)
downloadpleroma-98b96e45ababecb7554232787968f2f326f24e54.tar.gz
pleroma-98b96e45ababecb7554232787968f2f326f24e54.zip
Merge remote-tracking branch 'remotes/origin/develop' into output-of-relationships-in-statuses
# Conflicts: # CHANGELOG.md
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 d87eca836..7cfa40c51 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -784,12 +784,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])
@@ -799,6 +807,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()