diff options
author | link0ff <juri@linkov.net> | 2019-03-03 18:29:37 +0200 |
---|---|---|
committer | link0ff <juri@linkov.net> | 2019-03-03 18:29:37 +0200 |
commit | 19e2b852473ea4d371fb3d77e9344025e0499428 (patch) | |
tree | dcd43e823f7687767651e6eb0877b5b4aca53882 /test/web/oauth/oauth_controller_test.exs | |
parent | e278d470232f4e8081bbbe358137400074673e75 (diff) | |
parent | ace4231628ad1af08c8696fb7fe6983549f62631 (diff) | |
download | pleroma-19e2b852473ea4d371fb3d77e9344025e0499428.tar.gz pleroma-19e2b852473ea4d371fb3d77e9344025e0499428.zip |
Merge remote-tracking branch 'upstream/develop' into feature/openldap-support
Diffstat (limited to 'test/web/oauth/oauth_controller_test.exs')
-rw-r--r-- | test/web/oauth/oauth_controller_test.exs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs index 53d83e6e8..ed94416ff 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -165,10 +165,10 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do test "issues a token for request with HTTP basic auth client credentials" do user = insert(:user) - app = insert(:oauth_app, scopes: ["scope1", "scope2"]) + app = insert(:oauth_app, scopes: ["scope1", "scope2", "scope3"]) - {:ok, auth} = Authorization.create_authorization(app, user, ["scope2"]) - assert auth.scopes == ["scope2"] + {:ok, auth} = Authorization.create_authorization(app, user, ["scope1", "scope2"]) + assert auth.scopes == ["scope1", "scope2"] app_encoded = (URI.encode_www_form(app.client_id) <> ":" <> URI.encode_www_form(app.client_secret)) @@ -183,11 +183,13 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do "redirect_uri" => app.redirect_uris }) - assert %{"access_token" => token} = json_response(conn, 200) + assert %{"access_token" => token, "scope" => scope} = json_response(conn, 200) + + assert scope == "scope1 scope2" token = Repo.get_by(Token, token: token) assert token - assert token.scopes == ["scope2"] + assert token.scopes == ["scope1", "scope2"] end test "rejects token exchange with invalid client credentials" do |