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
17a1e281
Commit
17a1e281
authored
Dec 20, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit tests now work!!!
parent
683535d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
cms/djangoapps/contentstore/tests/test_course_settings.py
+12
-12
No files found.
cms/djangoapps/contentstore/tests/test_course_settings.py
View file @
17a1e281
...
...
@@ -11,6 +11,7 @@ from cms.djangoapps.models.settings.course_details import CourseDetails,\
import
json
from
util
import
converters
import
calendar
from
contentstore.settings.course_details
import
CourseDetailsEncoder
# YYYY-MM-DDThh:mm:ss.s+/-HH:MM
class
ConvertersTestCase
(
TestCase
):
...
...
@@ -104,7 +105,7 @@ class CourseDetailsTestCase(TestCase):
## NOTE: I couldn't figure out how to validly test time setting w/ all the conversions
jsondetails
=
CourseDetails
.
fetch
(
self
.
course_location
)
jsondetails
.
syllabus
=
"<a href='foo'>bar</a>"
self
.
assertEqual
(
CourseDetails
.
update_from_json
(
json
details
.
__dict__
)
.
syllabus
,
self
.
assertEqual
(
CourseDetails
.
update_from_json
(
json
.
dumps
(
jsondetails
,
encoding
=
CourseDetailsEncoder
)
)
.
syllabus
,
jsondetails
.
syllabus
,
"After set syllabus"
)
jsondetails
.
overview
=
"Overview"
self
.
assertEqual
(
CourseDetails
.
update_from_json
(
jsondetails
.
__dict__
)
.
overview
,
...
...
@@ -166,7 +167,7 @@ class CourseDetailsViewTest(TestCase):
def
alter_field
(
self
,
url
,
details
,
field
,
val
):
setattr
(
details
,
field
,
val
)
# jsondetails = json.dumps(details, cls=CourseSettingsEncoder)
resp
=
self
.
client
.
post
(
url
,
details
)
resp
=
self
.
client
.
post
(
url
,
details
.
__dict__
)
self
.
compare_details_with_encoding
(
json
.
loads
(
resp
.
content
),
details
.
__dict__
,
field
+
val
)
def
test_update_and_fetch
(
self
):
...
...
@@ -182,16 +183,15 @@ class CourseDetailsViewTest(TestCase):
resp
=
self
.
client
.
get
(
url
)
self
.
compare_details_with_encoding
(
json
.
loads
(
resp
.
content
),
details
.
__dict__
,
"virgin get"
)
# self.alter_field(url, details, 'start_date', time.time() * 1000)
# self.alter_field(url, details, 'start_date', time.time() * 1000 + 60 * 60 * 24)
# self.alter_field(url, details, 'end_date', time.time() * 1000 + 60 * 60 * 24 * 100)
# self.alter_field(url, details, 'enrollment_start', time.time() * 1000)
#
# self.alter_field(url, details, 'enrollment_end', time.time() * 1000 + 60 * 60 * 24 * 8)
# self.alter_field(url, details, 'syllabus', "<a href='foo'>bar</a>")
# self.alter_field(url, details, 'overview', "Overview")
# self.alter_field(url, details, 'intro_video', "intro_video")
# self.alter_field(url, details, 'effort', "effort")
self
.
alter_field
(
url
,
details
,
'start_date'
,
time
.
time
()
*
1000
)
self
.
alter_field
(
url
,
details
,
'start_date'
,
time
.
time
()
*
1000
+
60
*
60
*
24
)
self
.
alter_field
(
url
,
details
,
'end_date'
,
time
.
time
()
*
1000
+
60
*
60
*
24
*
100
)
self
.
alter_field
(
url
,
details
,
'enrollment_start'
,
time
.
time
()
*
1000
)
self
.
alter_field
(
url
,
details
,
'enrollment_end'
,
time
.
time
()
*
1000
+
60
*
60
*
24
*
8
)
self
.
alter_field
(
url
,
details
,
'overview'
,
"Overview"
)
self
.
alter_field
(
url
,
details
,
'intro_video'
,
"intro_video"
)
self
.
alter_field
(
url
,
details
,
'effort'
,
"effort"
)
def
compare_details_with_encoding
(
self
,
encoded
,
details
,
context
):
self
.
compare_date_fields
(
details
,
encoded
,
context
,
'start_date'
)
...
...
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