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
889f7d49
Commit
889f7d49
authored
5 years ago
by
usama sadiq
Committed by
usamasadiq
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updated LtiBackend.authenticate() method
Added a positional `request` arugment in the function header.
parent
e7f112c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/lti_provider/tests/test_users.py
+8
-0
8 additions, 0 deletions
lms/djangoapps/lti_provider/tests/test_users.py
lms/djangoapps/lti_provider/users.py
+1
-1
1 addition, 1 deletion
lms/djangoapps/lti_provider/users.py
with
9 additions
and
1 deletion
lms/djangoapps/lti_provider/tests/test_users.py
+
8
−
0
View file @
889f7d49
...
...
@@ -199,9 +199,13 @@ class LtiBackendTest(TestCase):
lti_user_id
=
self
.
lti_user_id
,
edx_user
=
self
.
edx_user
).
save
()
self
.
old_user
=
UserFactory
.
create
()
self
.
request
=
RequestFactory
().
post
(
'
/
'
)
self
.
request
.
user
=
self
.
old_user
def
test_valid_user_authenticates
(
self
):
user
=
users
.
LtiBackend
().
authenticate
(
self
.
request
,
username
=
self
.
edx_user
.
username
,
lti_user_id
=
self
.
lti_user_id
,
lti_consumer
=
self
.
lti_consumer
...
...
@@ -210,6 +214,7 @@ class LtiBackendTest(TestCase):
def
test_missing_user_returns_none
(
self
):
user
=
users
.
LtiBackend
().
authenticate
(
self
.
request
,
username
=
self
.
edx_user
.
username
,
lti_user_id
=
'
Invalid Username
'
,
lti_consumer
=
self
.
lti_consumer
...
...
@@ -220,12 +225,14 @@ class LtiBackendTest(TestCase):
non_edx_user
=
UserFactory
.
create
()
non_edx_user
.
save
()
user
=
users
.
LtiBackend
().
authenticate
(
self
.
request
,
username
=
non_edx_user
.
username
,
)
self
.
assertIsNone
(
user
)
def
test_missing_lti_id_returns_null
(
self
):
user
=
users
.
LtiBackend
().
authenticate
(
self
.
request
,
username
=
self
.
edx_user
.
username
,
lti_consumer
=
self
.
lti_consumer
)
...
...
@@ -233,6 +240,7 @@ class LtiBackendTest(TestCase):
def
test_missing_lti_consumer_returns_null
(
self
):
user
=
users
.
LtiBackend
().
authenticate
(
self
.
request
,
username
=
self
.
edx_user
.
username
,
lti_user_id
=
self
.
lti_user_id
,
)
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/lti_provider/users.py
+
1
−
1
View file @
889f7d49
...
...
@@ -119,7 +119,7 @@ class LtiBackend(object):
identity (i.e. the user was created by the create_lti_user method above).
"""
def
authenticate
(
self
,
username
=
None
,
lti_user_id
=
None
,
lti_consumer
=
None
):
def
authenticate
(
self
,
_request
,
username
=
None
,
lti_user_id
=
None
,
lti_consumer
=
None
):
"""
Try to authenticate a user. This method will return a Django user object
if a user with the corresponding username exists in the database, and
...
...
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