diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2020-04-09 18:28:14 +0400 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2020-04-13 18:17:08 +0400 |
commit | e4195d4a684908d58482f9c865375a080e7b78bc (patch) | |
tree | 63a27c7ff4ae1964f0994091a09b4ac803626a9b /test | |
parent | aa958a6dda7cdcf12e9cd9232e7c6be421610317 (diff) | |
download | pleroma-e4195d4a684908d58482f9c865375a080e7b78bc.tar.gz |
Add specs for AccountController.mute and AccountController.unmute
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/account_controller_test.exs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/web/mastodon_api/controllers/account_controller_test.exs index d56e7fb4a..91d4685cb 100644 --- a/test/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/web/mastodon_api/controllers/account_controller_test.exs @@ -751,32 +751,41 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do test "with notifications", %{conn: conn} do other_user = insert(:user) - ret_conn = post(conn, "/api/v1/accounts/#{other_user.id}/mute") + ret_conn = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/accounts/#{other_user.id}/mute") response = json_response(ret_conn, 200) assert %{"id" => _id, "muting" => true, "muting_notifications" => true} = response + assert_schema(response, "AccountRelationship", ApiSpec.spec()) conn = post(conn, "/api/v1/accounts/#{other_user.id}/unmute") response = json_response(conn, 200) assert %{"id" => _id, "muting" => false, "muting_notifications" => false} = response + assert_schema(response, "AccountRelationship", ApiSpec.spec()) end test "without notifications", %{conn: conn} do other_user = insert(:user) ret_conn = - post(conn, "/api/v1/accounts/#{other_user.id}/mute", %{"notifications" => "false"}) + conn + |> put_req_header("content-type", "multipart/form-data") + |> post("/api/v1/accounts/#{other_user.id}/mute", %{"notifications" => "false"}) response = json_response(ret_conn, 200) assert %{"id" => _id, "muting" => true, "muting_notifications" => false} = response + assert_schema(response, "AccountRelationship", ApiSpec.spec()) conn = post(conn, "/api/v1/accounts/#{other_user.id}/unmute") response = json_response(conn, 200) assert %{"id" => _id, "muting" => false, "muting_notifications" => false} = response + assert_schema(response, "AccountRelationship", ApiSpec.spec()) end end |