aboutsummaryrefslogtreecommitdiff
path: root/test/web/mastodon_api
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-11-26 18:48:56 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-11-27 17:52:02 +0700
commit1fc28a4b441fdc0de8b2b43e2b045da38ee50b0a (patch)
treed2794209c82c1df497f6926c910fff0d85621317 /test/web/mastodon_api
parent3c0abfca53751624ebd6ea7174ee880d9e7b29e7 (diff)
downloadpleroma-1fc28a4b441fdc0de8b2b43e2b045da38ee50b0a.tar.gz
Add a view for the move notification
Diffstat (limited to 'test/web/mastodon_api')
-rw-r--r--test/web/mastodon_api/views/notification_view_test.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs
index c9043a69a..80b6d414c 100644
--- a/test/web/mastodon_api/views/notification_view_test.exs
+++ b/test/web/mastodon_api/views/notification_view_test.exs
@@ -107,4 +107,28 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
assert [] ==
NotificationView.render("index.json", %{notifications: [notification], for: followed})
end
+
+ test "Move 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])
+ follower = insert(:user)
+
+ User.follow(follower, old_user)
+ Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
+ Pleroma.Tests.ObanHelpers.perform_all()
+
+ [notification] = Notification.for_user(follower)
+
+ expected = %{
+ id: to_string(notification.id),
+ pleroma: %{is_seen: false},
+ type: "move",
+ account: AccountView.render("show.json", %{user: old_user, for: follower}),
+ target: AccountView.render("show.json", %{user: new_user, for: follower}),
+ created_at: Utils.to_masto_date(notification.inserted_at)
+ }
+
+ assert [expected] ==
+ NotificationView.render("index.json", %{notifications: [notification], for: follower})
+ end
end