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
69432015
Commit
69432015
authored
Dec 30, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow removing upgrade deadlines through the Commerce API.
parent
bc61e72c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
lms/djangoapps/commerce/api/v1/models.py
+1
-2
lms/djangoapps/commerce/api/v1/tests/test_views.py
+21
-1
No files found.
lms/djangoapps/commerce/api/v1/models.py
View file @
69432015
...
...
@@ -87,8 +87,7 @@ class Course(object):
merged_mode
.
min_price
=
posted_mode
.
min_price
merged_mode
.
currency
=
posted_mode
.
currency
merged_mode
.
sku
=
posted_mode
.
sku
if
posted_mode
.
expiration_datetime
is
not
None
:
merged_mode
.
expiration_datetime
=
posted_mode
.
expiration_datetime
merged_mode
.
expiration_datetime
=
posted_mode
.
expiration_datetime
merged_mode
.
save
()
merged_modes
.
add
(
merged_mode
)
...
...
lms/djangoapps/commerce/api/v1/tests/test_views.py
View file @
69432015
""" Commerce API v1 view tests. """
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
import
itertools
import
json
...
...
@@ -226,6 +226,26 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertIsNone
(
VerificationDeadline
.
deadline_for_course
(
self
.
course
.
id
))
def
test_remove_upgrade_deadline
(
self
):
"""
Verify that course mode upgrade deadlines can be removed through the API.
"""
# First create a deadline
upgrade_deadline
=
datetime
.
now
(
pytz
.
utc
)
+
timedelta
(
days
=
1
)
response
,
__
=
self
.
_get_update_response_and_expected_data
(
upgrade_deadline
,
None
)
self
.
assertEqual
(
response
.
status_code
,
200
)
verified_mode
=
CourseMode
.
verified_mode_for_course
(
self
.
course
.
id
)
self
.
assertIsNotNone
(
verified_mode
)
self
.
assertEqual
(
verified_mode
.
expiration_datetime
.
date
(),
upgrade_deadline
.
date
())
# Now set the deadline to None
response
,
__
=
self
.
_get_update_response_and_expected_data
(
None
,
None
)
self
.
assertEqual
(
response
.
status_code
,
200
)
updated_verified_mode
=
CourseMode
.
verified_mode_for_course
(
self
.
course
.
id
)
self
.
assertIsNotNone
(
updated_verified_mode
)
self
.
assertIsNone
(
updated_verified_mode
.
expiration_datetime
)
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