diff options
author | marcin mikołajczak <git@mkljczk.pl> | 2022-03-16 14:39:02 +0100 |
---|---|---|
committer | marcin mikołajczak <git@mkljczk.pl> | 2022-03-16 16:52:33 +0100 |
commit | 6754d1f27239d3d529a3f667a6a93b267041daf0 (patch) | |
tree | 4d6b1b9ac9f4f6a8ca4dcedc5ffef25bdd005064 /test | |
parent | 4458db320160ff0a5e6e7e017e72cc84c933e67c (diff) | |
download | pleroma-6754d1f27239d3d529a3f667a6a93b267041daf0.tar.gz pleroma-6754d1f27239d3d529a3f667a6a93b267041daf0.zip |
POST /api/v1/accounts/:id/remove_from_followers
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/account_controller_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 853d2c111..b9ee173d6 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -1976,4 +1976,31 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do |> json_response_and_validate_schema(400) end end + + describe "remove from followers" do + setup do: oauth_access(["follow"]) + + test "removing user from followers", %{conn: conn, user: user} do + %{id: other_user_id} = other_user = insert(:user) + + CommonAPI.follow(other_user, user) + + assert %{"id" => _id, "followed_by" => false} = + conn + |> post("/api/v1/accounts/#{other_user_id}/remove_from_followers") + |> json_response_and_validate_schema(200) + end + + test "removing user from followers errors", %{user: user, conn: conn} do + # self remove + conn_res = post(conn, "/api/v1/accounts/#{user.id}/remove_from_followers") + + assert %{"error" => "Can not unfollow yourself"} = + json_response_and_validate_schema(conn_res, 400) + + # remove non existing user + conn_res = post(conn, "/api/v1/accounts/doesntexist/remove_from_followers") + assert %{"error" => "Record not found"} = json_response_and_validate_schema(conn_res, 404) + end + end end |