summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/notification_controller_test.exs
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2019-12-08 20:14:28 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2019-12-08 20:14:28 +0300
commit6fbafb1cdcba3dc2a7e8b9718e295c9811a726d9 (patch)
tree6b8e22663fd5b6d5cdf3afaa4b306775d59b503a /test/web/mastodon_api/controllers/notification_controller_test.exs
parent49bb0a130f93476d32d3177d7a989b7a98a063f2 (diff)
parentaf5fef1f228a1781d7d9cad490d3b3a783389f5e (diff)
downloadpleroma-6fbafb1cdcba3dc2a7e8b9718e295c9811a726d9.tar.gz
pleroma-6fbafb1cdcba3dc2a7e8b9718e295c9811a726d9.zip
Merge branch 'develop' into issue/1276
Diffstat (limited to 'test/web/mastodon_api/controllers/notification_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/notification_controller_test.exs32
1 files changed, 29 insertions, 3 deletions
diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs
index fa55a7cf9..f6d4ab9f0 100644
--- a/test/web/mastodon_api/controllers/notification_controller_test.exs
+++ b/test/web/mastodon_api/controllers/notification_controller_test.exs
@@ -289,7 +289,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
- {:ok, user} = User.mute(user, user2)
+ {:ok, _user_relationships} = User.mute(user, user2)
conn = assign(build_conn(), :user, user)
conn = get(conn, "/api/v1/notifications")
@@ -310,7 +310,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
- {:ok, user} = User.mute(user, user2, false)
+ {:ok, _user_relationships} = User.mute(user, user2, false)
conn = assign(build_conn(), :user, user)
conn = get(conn, "/api/v1/notifications")
@@ -333,7 +333,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
- {:ok, user} = User.mute(user, user2)
+ {:ok, _user_relationships} = User.mute(user, user2)
conn = assign(build_conn(), :user, user)
conn = get(conn, "/api/v1/notifications", %{"with_muted" => "true"})
@@ -341,6 +341,32 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
end
+ test "see move notifications with `with_move` parameter", %{
+ conn: conn
+ } do
+ old_user = insert(:user)
+ new_user = insert(:user, also_known_as: [old_user.ap_id])
+ follower = insert(:user)
+
+ User.follow(follower, old_user)
+ Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
+ Pleroma.Tests.ObanHelpers.perform_all()
+
+ conn =
+ conn
+ |> assign(:user, follower)
+ |> get("/api/v1/notifications")
+
+ assert json_response(conn, 200) == []
+
+ conn =
+ build_conn()
+ |> assign(:user, follower)
+ |> get("/api/v1/notifications", %{"with_move" => "true"})
+
+ assert length(json_response(conn, 200)) == 1
+ end
+
defp get_notification_id_by_activity(%{id: id}) do
Notification
|> Repo.get_by(activity_id: id)