diff options
author | Mark Felder <feld@feld.me> | 2024-09-04 10:40:37 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-09-04 10:40:37 -0400 |
commit | 7bd0750787859cb30382d90162d70380441abc05 (patch) | |
tree | 34280bf5f95597fc6f225a6740ab19bae464cfd7 /test | |
parent | 427da7a99a30ebc7a7deb54e7704b5d8dffea199 (diff) | |
download | pleroma-7bd0750787859cb30382d90162d70380441abc05.tar.gz pleroma-7bd0750787859cb30382d90162d70380441abc05.zip |
Ensure apps are assigned to users
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/o_auth/o_auth_controller_test.exs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index 83a08d9fc..260442771 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -12,6 +12,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do alias Pleroma.MFA.TOTP alias Pleroma.Repo alias Pleroma.User + alias Pleroma.Web.OAuth.App alias Pleroma.Web.OAuth.Authorization alias Pleroma.Web.OAuth.OAuthController alias Pleroma.Web.OAuth.Token @@ -770,6 +771,9 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do {:ok, auth} = Authorization.create_authorization(app, user, ["write"]) + # Verify app has no associated user yet + assert %Pleroma.Web.OAuth.App{user_id: nil} = Repo.get_by(App, %{id: app.id}) + conn = build_conn() |> post("/oauth/token", %{ @@ -786,6 +790,10 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do assert token assert token.scopes == auth.scopes assert user.ap_id == ap_id + + # Verify app has an associated user now + user_id = user.id + assert %Pleroma.Web.OAuth.App{user_id: ^user_id} = Repo.get_by(App, %{id: app.id}) end test "issues a token for `password` grant_type with valid credentials, with full permissions by default" do |