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
5a1df635
Commit
5a1df635
authored
10 years ago
by
Will Daly
Browse files
Options
Downloads
Plain Diff
Merge pull request #5735 from edx/will/update-release-10-27
Merge release into master (with changes from Friday 10/24/14)
parents
25a74552
0cac6ea2
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/student/tests/test_enrollment.py
+24
-4
24 additions, 4 deletions
common/djangoapps/student/tests/test_enrollment.py
common/djangoapps/third_party_auth/pipeline.py
+15
-14
15 additions, 14 deletions
common/djangoapps/third_party_auth/pipeline.py
with
39 additions
and
18 deletions
common/djangoapps/student/tests/test_enrollment.py
+
24
−
4
View file @
5a1df635
...
...
@@ -59,7 +59,7 @@ class EnrollmentTest(ModuleStoreTestCase):
# Professional ed
# Expect that we're sent to the "choose your track" page
# (which will, in turn, redirect us to a page where we can verify/pay)
# We should NOT be auto-enrolled, because that would be giving
# We should NOT be auto-enrolled, because that would be giving
# away an expensive course for free :)
([
'
professional
'
],
'
course_modes_choose
'
,
None
),
)
...
...
@@ -110,12 +110,32 @@ class EnrollmentTest(ModuleStoreTestCase):
self
.
client
.
logout
()
self
.
client
.
get
(
reverse
(
'
register_user
'
),
{
'
course_id
'
:
self
.
course
.
id
})
self
.
client
.
login
(
username
=
self
.
USERNAME
,
password
=
self
.
PASSWORD
)
self
.
dummy_request
=
RequestFactory
().
request
()
self
.
dummy_request
.
session
=
self
.
client
.
session
strategy
=
DjangoStrategy
(
RequestFactory
,
request
=
self
.
dummy_request
)
dummy_request
=
RequestFactory
().
request
()
dummy_request
.
session
=
self
.
client
.
session
strategy
=
DjangoStrategy
(
RequestFactory
,
request
=
dummy_request
)
change_enrollment_third_party
(
is_register
=
True
,
strategy
=
strategy
,
user
=
self
.
user
)
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
self
.
course
.
id
))
def
test_no_prof_ed_third_party_autoenroll
(
self
):
"""
Test that a user authenticating via third party auth while attempting to enroll
in a professional education course is not automatically enrolled in the course.
"""
self
.
client
.
logout
()
# Create the course mode required for this test case
CourseModeFactory
(
course_id
=
self
.
course
.
id
,
mode_slug
=
'
professional
'
)
self
.
client
.
get
(
reverse
(
'
register_user
'
),
{
'
course_id
'
:
self
.
course
.
id
})
self
.
client
.
login
(
username
=
self
.
USERNAME
,
password
=
self
.
PASSWORD
)
dummy_request
=
RequestFactory
().
request
()
dummy_request
.
session
=
self
.
client
.
session
strategy
=
DjangoStrategy
(
RequestFactory
,
request
=
dummy_request
)
change_enrollment_third_party
(
is_register
=
True
,
strategy
=
strategy
,
user
=
self
.
user
)
# Verify that the user has not been enrolled in the course
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
self
.
course
.
id
))
def
test_unenroll
(
self
):
# Enroll the student in the course
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course
.
id
,
mode
=
"
honor
"
)
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/third_party_auth/pipeline.py
+
15
−
14
View file @
5a1df635
...
...
@@ -69,8 +69,8 @@ from social.apps.django_app.default import models
from
social.exceptions
import
AuthException
from
social.pipeline
import
partial
from
student.models
import
CourseEnrollment
,
CourseEnrollmentException
from
opaque_keys.edx.
location
s
import
SlashSeparated
CourseKey
from
student.models
import
CourseMode
,
CourseEnrollment
,
CourseEnrollmentException
from
opaque_keys.edx.
key
s
import
CourseKey
from
logging
import
getLogger
...
...
@@ -408,7 +408,7 @@ def login_analytics(*args, **kwargs):
},
context
=
{
'
Google Analytics
'
:
{
'
clientId
'
:
tracking_context
.
get
(
'
client_id
'
)
'
clientId
'
:
tracking_context
.
get
(
'
client_id
'
)
}
}
)
...
...
@@ -420,14 +420,15 @@ def change_enrollment(*args, **kwargs):
a course, we automatically log them into that course.
"""
if
kwargs
[
'
strategy
'
].
session_get
(
'
registration_course_id
'
):
try
:
CourseEnrollment
.
enroll
(
kwargs
[
'
user
'
],
SlashSeparatedCourseKey
.
from_deprecated_string
(
kwargs
[
'
strategy
'
].
session_get
(
'
registration_course_id
'
)
)
)
except
CourseEnrollmentException
:
pass
except
Exception
,
e
:
logger
.
exception
(
e
)
course_id
=
CourseKey
.
from_string
(
kwargs
[
'
strategy
'
].
session_get
(
'
registration_course_id
'
)
)
available_modes
=
CourseMode
.
modes_for_course_dict
(
course_id
)
if
'
honor
'
in
available_modes
:
try
:
CourseEnrollment
.
enroll
(
kwargs
[
'
user
'
],
course_id
)
except
CourseEnrollmentException
:
pass
except
Exception
as
ex
:
logger
.
exception
(
ex
)
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