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
ebbeeb16
Commit
ebbeeb16
authored
Jul 31, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some unit tests for the new fields
parent
0937cdcb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
common/lib/xmodule/xmodule/tests/test_course_module.py
+11
-1
common/test/data/toy/roots/2012_Fall.xml
+2
-2
No files found.
common/lib/xmodule/xmodule/tests/test_course_module.py
View file @
ebbeeb16
...
@@ -53,7 +53,7 @@ def get_dummy_course(start, announcement=None, is_new=None, advertised_start=Non
...
@@ -53,7 +53,7 @@ def get_dummy_course(start, announcement=None, is_new=None, advertised_start=Non
end
=
to_attrb
(
'end'
,
end
)
end
=
to_attrb
(
'end'
,
end
)
start_xml
=
'''
start_xml
=
'''
<course org="{org}" course="{course}"
<course org="{org}" course="{course}"
display_organization="{org}_display" display_coursenumber="{course}_display"
graceperiod="1 day" url_name="test"
graceperiod="1 day" url_name="test"
start="{start}"
start="{start}"
{announcement}
{announcement}
...
@@ -141,6 +141,16 @@ class IsNewCourseTestCase(unittest.TestCase):
...
@@ -141,6 +141,16 @@ class IsNewCourseTestCase(unittest.TestCase):
print
"Checking start=
%
s advertised=
%
s"
%
(
s
[
0
],
s
[
1
])
print
"Checking start=
%
s advertised=
%
s"
%
(
s
[
0
],
s
[
1
])
self
.
assertEqual
(
d
.
start_date_text
,
s
[
2
])
self
.
assertEqual
(
d
.
start_date_text
,
s
[
2
])
def
test_display_organization
(
self
):
descriptor
=
get_dummy_course
(
start
=
'2012-12-02T12:00'
,
is_new
=
True
)
self
.
assertNotEqual
(
descriptor
.
location
.
org
,
descriptor
.
display_org_with_default
)
self
.
assertEqual
(
descriptor
.
display_org_with_default
,
"{0}_display"
.
format
(
ORG
))
def
test_display_coursenumber
(
self
):
descriptor
=
get_dummy_course
(
start
=
'2012-12-02T12:00'
,
is_new
=
True
)
self
.
assertNotEqual
(
descriptor
.
location
.
course
,
descriptor
.
display_number_with_default
)
self
.
assertEqual
(
descriptor
.
display_number_with_default
,
"{0}_display"
.
format
(
COURSE
))
def
test_is_newish
(
self
):
def
test_is_newish
(
self
):
descriptor
=
get_dummy_course
(
start
=
'2012-12-02T12:00'
,
is_new
=
True
)
descriptor
=
get_dummy_course
(
start
=
'2012-12-02T12:00'
,
is_new
=
True
)
assert
(
descriptor
.
is_newish
is
True
)
assert
(
descriptor
.
is_newish
is
True
)
...
...
common/test/data/toy/roots/2012_Fall.xml
View file @
ebbeeb16
<course
org=
"edX"
course=
"toy"
url_name=
"2012_Fall"
/>
<course
org=
"edX"
course=
"toy"
url_name=
"2012_Fall"
display_organization=
"edX_display"
display_coursenum=
"2012_Fall_Display"
/>
\ No newline at end of file
\ No newline at end of file
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