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
45bff268
Commit
45bff268
authored
Dec 30, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow removing a verification deadline through the Commerce API.
ECOM-3268
parent
d2392b45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
lms/djangoapps/commerce/api/v1/models.py
+1
-2
lms/djangoapps/commerce/api/v1/tests/test_views.py
+23
-0
No files found.
lms/djangoapps/commerce/api/v1/models.py
View file @
45bff268
...
...
@@ -59,8 +59,7 @@ class Course(object):
""" Save the CourseMode objects to the database. """
# Override the verification deadline for the course (not the individual modes)
if
self
.
verification_deadline
is
not
None
:
VerificationDeadline
.
set_deadline
(
self
.
id
,
self
.
verification_deadline
,
is_explicit
=
True
)
VerificationDeadline
.
set_deadline
(
self
.
id
,
self
.
verification_deadline
,
is_explicit
=
True
)
for
mode
in
self
.
modes
:
mode
.
course_id
=
self
.
id
...
...
lms/djangoapps/commerce/api/v1/tests/test_views.py
View file @
45bff268
...
...
@@ -203,6 +203,29 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
VerificationDeadline
.
deadline_for_course
(
self
.
course
.
id
),
verification_deadline
)
def
test_update_remove_verification_deadline
(
self
):
"""
Verify that verification deadlines can be removed through the API.
"""
verification_deadline
=
datetime
(
year
=
1915
,
month
=
5
,
day
=
7
,
tzinfo
=
pytz
.
utc
)
response
,
__
=
self
.
_get_update_response_and_expected_data
(
None
,
verification_deadline
)
self
.
assertEqual
(
VerificationDeadline
.
deadline_for_course
(
self
.
course
.
id
),
verification_deadline
)
verified_mode
=
CourseMode
(
mode_slug
=
u'verified'
,
min_price
=
200
,
currency
=
u'USD'
,
sku
=
u'ABC123'
,
expiration_datetime
=
None
)
updated_data
=
self
.
_serialize_course
(
self
.
course
,
[
verified_mode
],
None
)
updated_data
[
'verification_deadline'
]
=
None
response
=
self
.
client
.
put
(
self
.
path
,
json
.
dumps
(
updated_data
),
content_type
=
JSON_CONTENT_TYPE
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIsNone
(
VerificationDeadline
.
deadline_for_course
(
self
.
course
.
id
))
def
test_update_overwrite
(
self
):
""" Verify that data submitted via PUT overwrites/deletes modes that are
not included in the body of the request. """
...
...
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