Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jeff
pleroma
Commits
bb9e4096
Verified
Commit
bb9e4096
authored
6 years ago
by
Haelwenn
Browse files
Options
Downloads
Patches
Plain Diff
Web.OAuth.OAuthControllerTest: Add test against token formatting
parent
b6a001a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/web/oauth/oauth_controller_test.exs
+7
-5
7 additions, 5 deletions
test/web/oauth/oauth_controller_test.exs
with
7 additions
and
5 deletions
test/web/oauth/oauth_controller_test.exs
+
7
−
5
View file @
bb9e4096
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment