diff options
author | lambda <lain@soykaf.club> | 2019-04-15 10:24:37 +0000 |
---|---|---|
committer | lambda <lain@soykaf.club> | 2019-04-15 10:24:37 +0000 |
commit | f358295cbe8f1d250e92dcc9265cdc83cb2cabdd (patch) | |
tree | 5155bfdb8bfbb664b139100d8175fa35e6092765 /test | |
parent | f896699357fc7ba05fd539396bf22818d8bd98b4 (diff) | |
parent | 27d78dc5265ea90724c698162c24290ba1b99e13 (diff) | |
download | pleroma-f358295cbe8f1d250e92dcc9265cdc83cb2cabdd.tar.gz |
Merge branch 'unfollow-oneself' into 'develop'
Consistent response for self follow/unfollow
Closes #819
See merge request pleroma/pleroma!1061
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index df3315022..69e6e56a1 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1587,6 +1587,40 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert id == to_string(other_user.id) end + test "following / unfollowing errors" do + user = insert(:user) + + conn = + build_conn() + |> assign(:user, user) + + # self follow + conn_res = post(conn, "/api/v1/accounts/#{user.id}/follow") + assert %{"error" => "Record not found"} = json_response(conn_res, 404) + + # self unfollow + user = User.get_cached_by_id(user.id) + conn_res = post(conn, "/api/v1/accounts/#{user.id}/unfollow") + assert %{"error" => "Record not found"} = json_response(conn_res, 404) + + # self follow via uri + user = User.get_cached_by_id(user.id) + conn_res = post(conn, "/api/v1/follows", %{"uri" => user.nickname}) + assert %{"error" => "Record not found"} = json_response(conn_res, 404) + + # follow non existing user + conn_res = post(conn, "/api/v1/accounts/doesntexist/follow") + assert %{"error" => "Record not found"} = json_response(conn_res, 404) + + # follow non existing user via uri + conn_res = post(conn, "/api/v1/follows", %{"uri" => "doesntexist"}) + assert %{"error" => "Record not found"} = json_response(conn_res, 404) + + # unfollow non existing user + conn_res = post(conn, "/api/v1/accounts/doesntexist/unfollow") + assert %{"error" => "Record not found"} = json_response(conn_res, 404) + end + test "muting / unmuting a user", %{conn: conn} do user = insert(:user) other_user = insert(:user) |