diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-02-19 22:28:21 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-02-19 22:28:21 +0300 |
commit | 04ee877a20a849db53a307a1736e635229129b7a (patch) | |
tree | 41cf21ea4adb798dcb33bb41d7fab5b15c5ce154 /test/web/oauth/token_test.exs | |
parent | c0ecbf6669948740a091bdf5b5441fb6ee55f4fc (diff) | |
download | pleroma-04ee877a20a849db53a307a1736e635229129b7a.tar.gz pleroma-04ee877a20a849db53a307a1736e635229129b7a.zip |
[#468] Added OAuth scopes-specific tests.
Diffstat (limited to 'test/web/oauth/token_test.exs')
-rw-r--r-- | test/web/oauth/token_test.exs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/web/oauth/token_test.exs b/test/web/oauth/token_test.exs index a708e4991..62444a0fa 100644 --- a/test/web/oauth/token_test.exs +++ b/test/web/oauth/token_test.exs @@ -11,24 +11,26 @@ defmodule Pleroma.Web.OAuth.TokenTest do import Pleroma.Factory - test "exchanges a auth token for an access token" do + test "exchanges a auth token for an access token, preserving `scopes`" do {:ok, app} = Repo.insert( App.register_changeset(%App{}, %{ client_name: "client", - scopes: ["scope"], + scopes: ["read", "write"], redirect_uris: "url" }) ) user = insert(:user) - {:ok, auth} = Authorization.create_authorization(app, user) + {:ok, auth} = Authorization.create_authorization(app, user, ["read"]) + assert auth.scopes == ["read"] {:ok, token} = Token.exchange_token(app, auth) assert token.app_id == app.id assert token.user_id == user.id + assert token.scopes == auth.scopes assert String.length(token.token) > 10 assert String.length(token.refresh_token) > 10 |