diff options
author | Mark Felder <feld@feld.me> | 2024-09-01 12:37:59 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-09-01 12:37:59 -0400 |
commit | e3a7c1d906698d2f36661b60de4bdab5a475b871 (patch) | |
tree | 17f9015f85ea2159907fc3fd4235aae91faf3482 /test | |
parent | 5a1144208d1007af2a2d2279c582adf9d2fa7246 (diff) | |
download | pleroma-e3a7c1d906698d2f36661b60de4bdab5a475b871.tar.gz pleroma-e3a7c1d906698d2f36661b60de4bdab5a475b871.zip |
Test that app scopes can be updated
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/app_controller_test.exs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs index 1e2e68791..26c431673 100644 --- a/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs @@ -136,4 +136,37 @@ defmodule Pleroma.Web.MastodonAPI.AppControllerTest do assert List.first(apps).client_name == client_name assert List.first(apps).redirect_uris == redirect_uris end + + test "app scopes can be updated", %{conn: conn} do + client_name = "BleromaSE" + redirect_uris = "https://bleroma.app/oauth-callback" + website = "https://bleromase.com" + scopes = "read write" + + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/apps", %{ + client_name: client_name, + redirect_uris: redirect_uris, + website: website, + scopes: scopes + }) + |> json_response_and_validate_schema(200) + + assert List.first(Repo.all(App)).scopes == String.split(scopes, " ") + + updated_scopes = "read write push" + + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/apps", %{ + client_name: client_name, + redirect_uris: redirect_uris, + website: website, + scopes: updated_scopes + }) + |> json_response_and_validate_schema(200) + + assert List.first(Repo.all(App)).scopes == String.split(updated_scopes, " ") + end end |