Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Hsin-Yu Chien
edx-platform-release
Commits
83eb9e7f
Commit
83eb9e7f
authored
5 years ago
by
Jeremy Bowman
Browse files
Options
Downloads
Patches
Plain Diff
Fix auth_exchange tests BOM-648
parent
93142ebd
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/core/djangoapps/auth_exchange/tests/test_forms.py
+1
-1
1 addition, 1 deletion
openedx/core/djangoapps/auth_exchange/tests/test_forms.py
openedx/core/djangoapps/auth_exchange/tests/test_views.py
+8
-3
8 additions, 3 deletions
openedx/core/djangoapps/auth_exchange/tests/test_views.py
with
9 additions
and
4 deletions
openedx/core/djangoapps/auth_exchange/tests/test_forms.py
+
1
−
1
View file @
83eb9e7f
...
...
@@ -50,7 +50,7 @@ class AccessTokenExchangeFormTest(AccessTokenExchangeTestMixin):
self
.
assertTrue
(
form
.
is_valid
())
self
.
assertEqual
(
form
.
cleaned_data
[
"
user
"
],
self
.
user
)
self
.
assertEqual
(
form
.
cleaned_data
[
"
client
"
],
self
.
oauth_client
)
self
.
assertEqual
(
scope
.
to_names
(
form
.
cleaned_data
[
"
scope
"
]),
expected_scopes
)
self
.
assertEqual
(
set
(
scope
.
to_names
(
form
.
cleaned_data
[
"
scope
"
])
)
,
set
(
expected_scopes
)
)
# This is necessary because cms does not implement third party auth
...
...
This diff is collapsed.
Click to expand it.
openedx/core/djangoapps/auth_exchange/tests/test_views.py
+
8
−
3
View file @
83eb9e7f
...
...
@@ -63,11 +63,16 @@ class AccessTokenExchangeViewTest(AccessTokenExchangeTestMixin):
timedelta
(
seconds
=
int
(
content
[
"
expires_in
"
])),
provider
.
constants
.
EXPIRE_DELTA_PUBLIC
)
self
.
assertEqual
(
content
[
"
scope
"
],
'
'
.
join
(
expected_scopes
))
actual_scopes
=
content
[
"
scope
"
]
if
actual_scopes
:
actual_scopes
=
actual_scopes
.
split
(
'
'
)
else
:
actual_scopes
=
[]
self
.
assertEqual
(
set
(
actual_scopes
),
set
(
expected_scopes
))
token
=
self
.
oauth2_adapter
.
get_access_token
(
token_string
=
content
[
"
access_token
"
])
self
.
assertEqual
(
token
.
user
,
self
.
user
)
self
.
assertEqual
(
self
.
oauth2_adapter
.
get_client_for_token
(
token
),
self
.
oauth_client
)
self
.
assertEqual
(
self
.
oauth2_adapter
.
get_token_scope_names
(
token
),
expected_scopes
)
self
.
assertEqual
(
set
(
self
.
oauth2_adapter
.
get_token_scope_names
(
token
)
)
,
set
(
expected_scopes
)
)
def
test_single_access_token
(
self
):
def
extract_token
(
response
):
...
...
@@ -184,7 +189,7 @@ class TestLoginWithAccessTokenView(TestCase):
Calls the login_with_access_token endpoint and verifies the response given the expected values.
"""
url
=
reverse
(
"
login_with_access_token
"
)
response
=
self
.
client
.
post
(
url
,
HTTP_AUTHORIZATION
=
b
"
Bearer {0}
"
.
format
(
access_token
))
response
=
self
.
client
.
post
(
url
,
HTTP_AUTHORIZATION
=
u
"
Bearer {0}
"
.
format
(
access_token
)
.
encode
(
'
utf-8
'
)
)
self
.
assertEqual
(
response
.
status_code
,
expected_status_code
)
if
expected_cookie_name
:
self
.
assertIn
(
expected_cookie_name
,
response
.
cookies
)
...
...
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