diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2019-07-14 13:29:31 +0000 |
---|---|---|
committer | kaniini <ariadne@dereferenced.org> | 2019-07-14 13:29:31 +0000 |
commit | e7c39b7ac8f0462ab563d3cf51f24c76feab0e8d (patch) | |
tree | c1de518adad818122896794f646c679db91f5538 /test/web/twitter_api | |
parent | 9f211838eca3793bac8bbb6b64f200a8a6c8d29f (diff) | |
download | pleroma-e7c39b7ac8f0462ab563d3cf51f24c76feab0e8d.tar.gz |
Feature/1072 muting notifications
Diffstat (limited to 'test/web/twitter_api')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 7ec0e101d..de6177575 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -521,6 +521,38 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do for: current_user }) end + + test "muted user", %{conn: conn, user: current_user} do + other_user = insert(:user) + + {:ok, current_user} = User.mute(current_user, other_user) + + {:ok, _activity} = + ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user}) + + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> get("/api/qvitter/statuses/notifications.json") + + assert json_response(conn, 200) == [] + end + + test "muted user with with_muted parameter", %{conn: conn, user: current_user} do + other_user = insert(:user) + + {:ok, current_user} = User.mute(current_user, other_user) + + {:ok, _activity} = + ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user}) + + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> get("/api/qvitter/statuses/notifications.json", %{"with_muted" => "true"}) + + assert length(json_response(conn, 200)) == 1 + end end describe "POST /api/qvitter/statuses/notifications/read" do |