summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/notification_controller_test.exs
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2020-01-21 19:45:13 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2020-01-21 19:45:13 +0300
commit22e94bb2c7a4de93a741b7ca45148cee4a0d601a (patch)
treec1e388a0d21ff768d8b53bc53662d96cbc3d2ae1 /test/web/mastodon_api/controllers/notification_controller_test.exs
parentcde828ff7df64740f36b2fc9dfdbfc8d76a8a78d (diff)
parent04c9ca5d68eb4d9c8abc82a91d5df3c483089b9b (diff)
downloadpleroma-22e94bb2c7a4de93a741b7ca45148cee4a0d601a.tar.gz
pleroma-22e94bb2c7a4de93a741b7ca45148cee4a0d601a.zip
Merge branch 'develop' into fix/attachments-cleanup
Diffstat (limited to 'test/web/mastodon_api/controllers/notification_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/notification_controller_test.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs
index 86303f92f..6f0606250 100644
--- a/test/web/mastodon_api/controllers/notification_controller_test.exs
+++ b/test/web/mastodon_api/controllers/notification_controller_test.exs
@@ -457,6 +457,30 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
end
end
+ describe "from specified user" do
+ test "account_id" do
+ %{user: user, conn: conn} = oauth_access(["read:notifications"])
+
+ %{id: account_id} = other_user1 = insert(:user)
+ other_user2 = insert(:user)
+
+ {:ok, _activity} = CommonAPI.post(other_user1, %{"status" => "hi @#{user.nickname}"})
+ {:ok, _activity} = CommonAPI.post(other_user2, %{"status" => "bye @#{user.nickname}"})
+
+ assert [%{"account" => %{"id" => ^account_id}}] =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/notifications", %{account_id: account_id})
+ |> json_response(200)
+
+ assert %{"error" => "Account is not found"} =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/notifications", %{account_id: "cofe"})
+ |> json_response(404)
+ end
+ end
+
defp get_notification_id_by_activity(%{id: id}) do
Notification
|> Repo.get_by(activity_id: id)