summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/notification_controller_test.exs
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2020-01-20 12:55:51 -0600
committerMark Felder <feld@FreeBSD.org>2020-01-20 12:55:51 -0600
commit390bf9b097cab96b9d3a0214f974044667524442 (patch)
tree2f0a6fbefb264dcedb12910870db0f9aea8c3d29 /test/web/mastodon_api/controllers/notification_controller_test.exs
parentcde828ff7df64740f36b2fc9dfdbfc8d76a8a78d (diff)
parentab36459464311389c2929ff1c48537889066a9f8 (diff)
downloadpleroma-390bf9b097cab96b9d3a0214f974044667524442.tar.gz
pleroma-390bf9b097cab96b9d3a0214f974044667524442.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)