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
0aa9c6c1
Commit
0aa9c6c1
authored
Jul 17, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
json field value conversion test
parent
badf86f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
cms/djangoapps/contentstore/tests/test_item.py
+34
-3
No files found.
cms/djangoapps/contentstore/tests/test_item.py
View file @
0aa9c6c1
...
@@ -4,6 +4,8 @@ from django.core.urlresolvers import reverse
...
@@ -4,6 +4,8 @@ from django.core.urlresolvers import reverse
from
xmodule.capa_module
import
CapaDescriptor
from
xmodule.capa_module
import
CapaDescriptor
import
json
import
json
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
import
datetime
from
pytz
import
UTC
class
DeleteItem
(
CourseTestCase
):
class
DeleteItem
(
CourseTestCase
):
...
@@ -151,16 +153,16 @@ class TestEditItem(CourseTestCase):
...
@@ -151,16 +153,16 @@ class TestEditItem(CourseTestCase):
reverse
(
'create_item'
),
reverse
(
'create_item'
),
json
.
dumps
(
json
.
dumps
(
{
'parent_location'
:
chap_location
,
{
'parent_location'
:
chap_location
,
'category'
:
'
vertic
al'
'category'
:
'
sequenti
al'
}),
}),
content_type
=
"application/json"
content_type
=
"application/json"
)
)
vert
_location
=
self
.
response_id
(
resp
)
self
.
seq
_location
=
self
.
response_id
(
resp
)
# create problem w/ boilerplate
# create problem w/ boilerplate
template_id
=
'multiplechoice.yaml'
template_id
=
'multiplechoice.yaml'
resp
=
self
.
client
.
post
(
resp
=
self
.
client
.
post
(
reverse
(
'create_item'
),
reverse
(
'create_item'
),
json
.
dumps
({
'parent_location'
:
vert
_location
,
json
.
dumps
({
'parent_location'
:
self
.
seq
_location
,
'category'
:
'problem'
,
'category'
:
'problem'
,
'boilerplate'
:
template_id
'boilerplate'
:
template_id
}),
}),
...
@@ -210,3 +212,32 @@ class TestEditItem(CourseTestCase):
...
@@ -210,3 +212,32 @@ class TestEditItem(CourseTestCase):
)
)
problem
=
modulestore
(
'draft'
)
.
get_item
(
self
.
problems
[
0
])
problem
=
modulestore
(
'draft'
)
.
get_item
(
self
.
problems
[
0
])
self
.
assertIsNone
(
problem
.
markdown
)
self
.
assertIsNone
(
problem
.
markdown
)
def
test_date_fields
(
self
):
"""
Test setting due & start dates on sequential
"""
sequential
=
modulestore
()
.
get_item
(
self
.
seq_location
)
self
.
assertIsNone
(
sequential
.
lms
.
due
)
self
.
client
.
post
(
reverse
(
'save_item'
),
json
.
dumps
({
'id'
:
self
.
seq_location
,
'metadata'
:
{
'due'
:
'2010-11-22T04:00Z'
}
}),
content_type
=
"application/json"
)
sequential
=
modulestore
()
.
get_item
(
self
.
seq_location
)
self
.
assertEqual
(
sequential
.
lms
.
due
,
datetime
.
datetime
(
2010
,
11
,
22
,
4
,
0
,
tzinfo
=
UTC
))
self
.
client
.
post
(
reverse
(
'save_item'
),
json
.
dumps
({
'id'
:
self
.
seq_location
,
'metadata'
:
{
'start'
:
'2010-09-12T14:00Z'
}
}),
content_type
=
"application/json"
)
sequential
=
modulestore
()
.
get_item
(
self
.
seq_location
)
self
.
assertEqual
(
sequential
.
lms
.
due
,
datetime
.
datetime
(
2010
,
11
,
22
,
4
,
0
,
tzinfo
=
UTC
))
self
.
assertEqual
(
sequential
.
lms
.
start
,
datetime
.
datetime
(
2010
,
9
,
12
,
14
,
0
,
tzinfo
=
UTC
))
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