diff options
author | lain <lain@soykaf.club> | 2020-01-15 14:05:22 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-01-15 14:05:22 +0000 |
commit | 1b233aa6531b26943bd78c5d4cd8e00f2e1d318e (patch) | |
tree | da1ba7f6a4505fea81262ec903b7c9f0ebef3ba3 /test | |
parent | 77412d5dd24a384f9be7d6bc6b1538415c584802 (diff) | |
parent | 023b7f605b5736b561f5b3a59de4d602933d7c71 (diff) | |
download | pleroma-1b233aa6531b26943bd78c5d4cd8e00f2e1d318e.tar.gz |
Merge branch 'notifications-from-account' into 'develop'
[#1470] Add support for `account_id` param to filter notifications by the account
See merge request pleroma/pleroma!2073
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/notification_controller_test.exs | 24 |
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) |