summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWill Pearson <uiri00@gmail.com>2018-08-31 20:59:43 -0700
committerWill Pearson <uiri00@gmail.com>2018-08-31 21:04:46 -0700
commit0c2a0e3551f26bff8fa6161356ddcefb791baccf (patch)
tree32863cd983a8d687ee7044e25d142d20ddff6ab3 /test
parentd31bbb1cfe04ca6073a322bcf77239e7d4b79839 (diff)
downloadpleroma-0c2a0e3551f26bff8fa6161356ddcefb791baccf.tar.gz
pleroma-0c2a0e3551f26bff8fa6161356ddcefb791baccf.zip
Specify default scope in verify_credentials
Certain Mastodon/Pleroma front ends call verify_credentials to get the default scope of a new toot. Currently, Pleroma hardcodes this value to "public". This patch changes it to the user's default_scope value.
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index d4ff16c68..60dafcf03 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -206,7 +206,19 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> get("/api/v1/accounts/verify_credentials")
- assert %{"id" => id} = json_response(conn, 200)
+ assert %{"id" => id, "source" => %{"privacy" => "public"}} = json_response(conn, 200)
+ assert id == to_string(user.id)
+ end
+
+ test "verify_credentials default scope unlisted", %{conn: conn} do
+ user = insert(:user, %{info: %{"default_scope" => "unlisted"}})
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/accounts/verify_credentials")
+
+ assert %{"id" => id, "source" => %{"privacy" => "unlisted"}} = json_response(conn, 200)
assert id == to_string(user.id)
end
@@ -715,6 +727,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert User.following?(other_user, user) == true
end
+ test "verify_credentials", %{conn: conn} do
+ user = insert(:user, %{info: %{"default_scope" => "private"}})
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/accounts/verify_credentials")
+
+ assert %{"id" => id, "source" => %{"privacy" => "private"}} = json_response(conn, 200)
+ assert id == to_string(user.id)
+ end
+
test "/api/v1/follow_requests/:id/reject works" do
user = insert(:user, %{info: %{"locked" => true}})
other_user = insert(:user)