aboutsummaryrefslogtreecommitdiff
path: root/test/web/twitter_api/twitter_api_controller_test.exs
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-07-14 13:29:32 +0000
committerkaniini <ariadne@dereferenced.org>2019-07-14 13:29:32 +0000
commit1589b170e80fa33ffcfd7fd85aec115d7765375d (patch)
treec1de518adad818122896794f646c679db91f5538 /test/web/twitter_api/twitter_api_controller_test.exs
parent9f211838eca3793bac8bbb6b64f200a8a6c8d29f (diff)
parente7c39b7ac8f0462ab563d3cf51f24c76feab0e8d (diff)
downloadpleroma-1589b170e80fa33ffcfd7fd85aec115d7765375d.tar.gz
Merge branch 'feature/1072-muting-notifications' into 'develop'
Feature/1072 muting notifications Closes #1072 See merge request pleroma/pleroma!1398
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r--test/web/twitter_api/twitter_api_controller_test.exs32
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