diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-01-15 18:12:08 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-01-15 18:12:08 +0300 |
commit | 5304c8cd21d72d66e5e9dc9f057ffbbe027ef5fa (patch) | |
tree | d463c35ba67fe75d8eea92097db43650f5626129 /test/web/mastodon_api/controllers/notification_controller_test.exs | |
parent | 76c1948880687ed74e0275e51808c0ddc6be887d (diff) | |
parent | 1b233aa6531b26943bd78c5d4cd8e00f2e1d318e (diff) | |
download | pleroma-5304c8cd21d72d66e5e9dc9f057ffbbe027ef5fa.tar.gz pleroma-5304c8cd21d72d66e5e9dc9f057ffbbe027ef5fa.zip |
Merge remote-tracking branch 'remotes/origin/develop' into 1478-oauth-admin-scopes-tweaks
Diffstat (limited to 'test/web/mastodon_api/controllers/notification_controller_test.exs')
-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) |