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
a3d51192
Commit
a3d51192
authored
Jul 12, 2017
by
Simon Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow enrollment into expired seats if the api is called by ecom service
parent
72c9d58a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
common/djangoapps/enrollment/tests/test_views.py
+9
-4
common/djangoapps/enrollment/views.py
+3
-1
No files found.
common/djangoapps/enrollment/tests/test_views.py
View file @
a3d51192
...
...
@@ -899,7 +899,12 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase, Ente
self
.
assert_enrollment_status
(
username
=
'fake-user'
,
expected_status
=
status
.
HTTP_406_NOT_ACCEPTABLE
,
as_server
=
True
)
def
test_update_enrollment_with_expired_mode_throws_error
(
self
):
@ddt.data
(
(
True
,
CourseMode
.
VERIFIED
),
(
False
,
CourseMode
.
DEFAULT_MODE_SLUG
)
)
@ddt.unpack
def
test_update_enrollment_with_expired_mode
(
self
,
using_api_key
,
updated_mode
):
"""Verify that if verified mode is expired than it's enrollment cannot be updated. """
for
mode
in
[
CourseMode
.
DEFAULT_MODE_SLUG
,
CourseMode
.
VERIFIED
]:
CourseModeFactory
.
create
(
...
...
@@ -922,13 +927,13 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase, Ente
mode
.
expiration_datetime
=
datetime
.
datetime
(
year
=
1970
,
month
=
1
,
day
=
1
,
tzinfo
=
pytz
.
utc
)
mode
.
save
()
self
.
assert_enrollment_status
(
as_server
=
True
,
as_server
=
using_api_key
,
mode
=
CourseMode
.
VERIFIED
,
expected_status
=
status
.
HTTP_
400_BAD_REQUEST
expected_status
=
status
.
HTTP_
200_OK
if
using_api_key
else
status
.
HTTP_403_FORBIDDEN
)
course_mode
,
is_active
=
CourseEnrollment
.
enrollment_mode_for_user
(
self
.
user
,
self
.
course
.
id
)
self
.
assertTrue
(
is_active
)
self
.
assertEqual
(
course_mode
,
CourseMode
.
DEFAULT_MODE_SLUG
)
self
.
assertEqual
(
course_mode
,
updated_mode
)
def
test_enterprise_course_enrollment_invalid_consent
(
self
):
"""Verify that the enterprise_course_consent must be a boolean. """
...
...
common/djangoapps/enrollment/views.py
View file @
a3d51192
...
...
@@ -637,7 +637,9 @@ class EnrollmentListView(APIView, ApiKeyPermissionMixIn):
unicode
(
course_id
),
mode
=
mode
,
is_active
=
is_active
,
enrollment_attributes
=
enrollment_attributes
enrollment_attributes
=
enrollment_attributes
,
# If we are updating enrollment by authorized api caller, we should allow expired modes
include_expired
=
has_api_key_permissions
)
else
:
# Will reactivate inactive enrollments.
...
...
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