diff options
author | marcin mikołajczak <git@mkljczk.pl> | 2021-12-06 21:13:14 +0100 |
---|---|---|
committer | marcin mikołajczak <git@mkljczk.pl> | 2021-12-06 21:15:03 +0100 |
commit | 3892bd353b68aff51fd596239de43fb320616eac (patch) | |
tree | bc0a721a17378fb02642a2925b2b3aca7b66cf15 | |
parent | 64a4c147b1836be8af0c87b23073ed82bb9cf67c (diff) | |
download | pleroma-3892bd353b68aff51fd596239de43fb320616eac.tar.gz pleroma-3892bd353b68aff51fd596239de43fb320616eac.zip |
Add test for following with subscription
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/account_controller_test.exs | 21 |
1 files changed, 21 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 a92a58224..70c6b152e 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -922,6 +922,27 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do |> json_response_and_validate_schema(200) end + test "following with subscription and unsubscribing when notify is nil" do + %{conn: conn} = oauth_access(["follow"]) + followed = insert(:user) + + ret_conn = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: true}) + + assert %{"id" => _id, "subscribing" => true} = + json_response_and_validate_schema(ret_conn, 200) + + ret_conn = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/accounts/#{followed.id}/follow") + + assert %{"id" => _id, "subscribing" => false} = + json_response_and_validate_schema(ret_conn, 200) + end + test "following / unfollowing errors", %{user: user, conn: conn} do # self follow conn_res = post(conn, "/api/v1/accounts/#{user.id}/follow") |