Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
b1f748b5
Commit
b1f748b5
authored
8 years ago
by
Juan Camilo Montoya
Browse files
Options
Downloads
Patches
Plain Diff
added unit test
parent
c5809b95
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/tests/test_html_module.py
+63
-0
63 additions, 0 deletions
common/lib/xmodule/xmodule/tests/test_html_module.py
with
63 additions
and
0 deletions
common/lib/xmodule/xmodule/tests/test_html_module.py
+
63
−
0
View file @
b1f748b5
...
...
@@ -181,3 +181,66 @@ class CourseInfoModuleTestCase(unittest.TestCase):
info_module
.
get_html
()
except
ValueError
:
self
.
fail
(
"
CourseInfoModule could not parse an invalid date!
"
)
def
test_updates_order
(
self
):
"""
Tests that a course info module will render its updates in the correct order.
"""
sample_update_data
=
[
{
"
id
"
:
3
,
"
date
"
:
"
March 18, 1982
"
,
"
content
"
:
"
This is a very important update that was inserted last with an older date!
"
,
"
status
"
:
CourseInfoModule
.
STATUS_VISIBLE
,
},
{
"
id
"
:
1
,
"
date
"
:
"
January 1, 2012
"
,
"
content
"
:
"
This is a very important update that was inserted first!
"
,
"
status
"
:
CourseInfoModule
.
STATUS_VISIBLE
,
},
{
"
id
"
:
2
,
"
date
"
:
"
January 1, 2012
"
,
"
content
"
:
"
This is a very important update that was inserted second!
"
,
"
status
"
:
CourseInfoModule
.
STATUS_VISIBLE
,
}
]
info_module
=
CourseInfoModule
(
Mock
(),
Mock
(),
DictFieldData
({
'
items
'
:
sample_update_data
,
'
data
'
:
""
}),
Mock
()
)
# This is the expected context that should be used by the render function
expected_context
=
{
'
visible_updates
'
:
[
{
"
id
"
:
2
,
"
date
"
:
"
January 1, 2012
"
,
"
content
"
:
"
This is a very important update that was inserted second!
"
,
"
status
"
:
CourseInfoModule
.
STATUS_VISIBLE
,
},
{
"
id
"
:
1
,
"
date
"
:
"
January 1, 2012
"
,
"
content
"
:
"
This is a very important update that was inserted first!
"
,
"
status
"
:
CourseInfoModule
.
STATUS_VISIBLE
,
},
{
"
id
"
:
3
,
"
date
"
:
"
March 18, 1982
"
,
"
content
"
:
"
This is a very important update that was inserted last with an older date!
"
,
"
status
"
:
CourseInfoModule
.
STATUS_VISIBLE
,
}
],
'
hidden_updates
'
:
[],
}
template_name
=
"
{0}/course_updates.html
"
.
format
(
info_module
.
TEMPLATE_DIR
)
info_module
.
get_html
()
# Assertion to validate that render function is called with the expected context
info_module
.
system
.
render_template
.
assert_called_once_with
(
template_name
,
expected_context
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment