diff options
author | lain <lain@soykaf.club> | 2020-01-15 14:29:56 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-01-15 14:29:56 +0000 |
commit | aa9fe3a712ac14dd2ee3227e6066bd3c47e9a5f3 (patch) | |
tree | 5769cb152707b52d5045234e86a87f63dafa38ac /test/web/mastodon_api/controllers/notification_controller_test.exs | |
parent | c9f45edeac2cc3ed262bb4b30dc7e1120c6fa047 (diff) | |
parent | 1b233aa6531b26943bd78c5d4cd8e00f2e1d318e (diff) | |
download | pleroma-aa9fe3a712ac14dd2ee3227e6066bd3c47e9a5f3.tar.gz |
Merge branch 'develop' into 'feature/tag_feed'
# Conflicts:
# CHANGELOG.md
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) |