diff options
author | Mark Felder <feld@feld.me> | 2021-02-18 17:23:17 -0600 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2021-02-18 17:23:17 -0600 |
commit | 63739c5a58ccb65dd4a63019b270429d5a462e71 (patch) | |
tree | 3b8165f14cd533ac4e10445e6704fa195e4276c5 /test/pleroma/web/mastodon_api/controllers/status_controller_test.exs | |
parent | 83301fe61aa3d453b7c12ee1f5465d9802d07370 (diff) |
Tests to validate client disclosure obeys user setting
Diffstat (limited to 'test/pleroma/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/status_controller_test.exs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 1ca829544..bae2ad4bf 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -358,8 +358,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do assert activity.data["cc"] == [] end - test "preserves client application metadata" do - %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"]) + test "discloses application metadata when enabled" do + user = insert(:user, disclose_client: true) + %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"], user: user) %Pleroma.Web.OAuth.Token{ app: %Pleroma.Web.OAuth.App{ @@ -383,6 +384,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do } } = json_response_and_validate_schema(result, 200) end + + test "hides application metadata when disabled" do + user = insert(:user, disclose_client: false) + %{user: _user, token: _token, conn: conn} = oauth_access(["write:statuses"], user: user) + + result = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses", %{ + "status" => "club mate is my wingman" + }) + + assert %{ + "content" => "club mate is my wingman", + "application" => nil + } = json_response_and_validate_schema(result, 200) + end end describe "posting scheduled statuses" do |