Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
534d1b52
Commit
534d1b52
authored
Sep 10, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release'
parents
a9389747
0dbd3cd2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
common/djangoapps/course_modes/tests/test_views.py
+28
-0
common/djangoapps/course_modes/views.py
+3
-1
common/templates/course_modes/choose.html
+2
-1
No files found.
common/djangoapps/course_modes/tests/test_views.py
View file @
534d1b52
...
...
@@ -12,6 +12,7 @@ from xmodule.modulestore.tests.django_utils import (
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
course_modes.tests.factories
import
CourseModeFactory
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
from
student.models
import
CourseEnrollment
# Since we don't need any XML course fixtures, use a modulestore configuration
...
...
@@ -221,3 +222,30 @@ class CourseModeViewTest(ModuleStoreTestCase):
actual_amount
=
self
.
client
.
session
[
'donation_for_course'
][
unicode
(
self
.
course
.
id
)]
expected_amount
=
decimal
.
Decimal
(
self
.
POST_PARAMS_FOR_COURSE_MODE
[
'verified'
][
'contribution'
])
self
.
assertEqual
(
actual_amount
,
expected_amount
)
def
test_enrollment_skipped_if_autoreg
(
self
):
# TODO (ECOM-16): Remove once we complete the auto-reg AB test.
session
=
self
.
client
.
session
session
[
'auto_register'
]
=
True
session
.
save
()
# Create the course modes
for
mode
in
(
'audit'
,
'honor'
,
'verified'
):
CourseModeFactory
(
mode_slug
=
mode
,
course_id
=
self
.
course
.
id
)
# Now enroll in the course
CourseEnrollmentFactory
(
user
=
self
.
user
,
is_active
=
True
,
mode
=
"honor"
,
course_id
=
unicode
(
self
.
course
.
id
),
)
# Choose the mode (POST request)
choose_track_url
=
reverse
(
'course_modes_choose'
,
args
=
[
unicode
(
self
.
course
.
id
)])
self
.
client
.
post
(
choose_track_url
,
self
.
POST_PARAMS_FOR_COURSE_MODE
[
'audit'
])
# Verify that enrollment mode is still honor
mode
,
is_active
=
CourseEnrollment
.
enrollment_mode_for_user
(
self
.
user
,
self
.
course
.
id
)
self
.
assertEqual
(
mode
,
"honor"
)
self
.
assertEqual
(
is_active
,
True
)
common/djangoapps/course_modes/views.py
View file @
534d1b52
...
...
@@ -141,7 +141,9 @@ class ChooseModeView(View):
return
HttpResponseBadRequest
(
_
(
"Enrollment mode not supported"
))
if
requested_mode
in
(
"audit"
,
"honor"
):
CourseEnrollment
.
enroll
(
user
,
course_key
,
requested_mode
)
# TODO (ECOM-16): Skip enrollment if we're in the experimental branch
if
not
request
.
session
.
get
(
'auto_register'
,
False
):
CourseEnrollment
.
enroll
(
user
,
course_key
,
requested_mode
)
return
redirect
(
'dashboard'
)
mode_info
=
allowed_modes
[
requested_mode
]
...
...
common/templates/course_modes/choose.html
View file @
534d1b52
...
...
@@ -275,7 +275,8 @@ $(document).ready(function() {
% endif
%if not upgrade:
## TODO (ECOM-16): For the duration of the experiment, audit track enrollment is skipped
## to keep the user on the honor track
% if "audit" in modes:
<span
class=
"deco-divider"
>
<span
class=
"copy"
>
${_("or")}
</span>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment