Fix format parameter and test
This commit is contained in:
@@ -336,7 +336,7 @@ def _course_outline_json(request, course_module):
|
||||
"""
|
||||
Returns a JSON representation of the course module and recursively all of its children.
|
||||
"""
|
||||
is_concise = request.GET.get('formats') == 'concise'
|
||||
is_concise = request.GET.get('format') == 'concise'
|
||||
include_children_predicate = lambda xblock: not xblock.category == 'vertical'
|
||||
if is_concise:
|
||||
include_children_predicate = lambda xblock: xblock.has_children
|
||||
|
||||
@@ -369,9 +369,8 @@ class TestCourseOutline(CourseTestCase):
|
||||
self.assertEqual(json_response['category'], 'course')
|
||||
self.assertEqual(json_response['id'], unicode(self.course.location))
|
||||
self.assertEqual(json_response['display_name'], self.course.display_name)
|
||||
if not is_concise:
|
||||
self.assertTrue(json_response['published'])
|
||||
self.assertIsNone(json_response['visibility_state'])
|
||||
self.assertNotEqual(json_response.get('published', False), is_concise)
|
||||
self.assertIsNone(json_response.get('visibility_state'))
|
||||
|
||||
# Now verify the first child
|
||||
children = json_response['child_info']['children']
|
||||
@@ -380,8 +379,8 @@ class TestCourseOutline(CourseTestCase):
|
||||
self.assertEqual(first_child_response['category'], 'chapter')
|
||||
self.assertEqual(first_child_response['id'], unicode(self.chapter.location))
|
||||
self.assertEqual(first_child_response['display_name'], 'Week 1')
|
||||
self.assertNotEqual(json_response.get('published', False), is_concise)
|
||||
if not is_concise:
|
||||
self.assertTrue(json_response['published'])
|
||||
self.assertEqual(first_child_response['visibility_state'], VisibilityState.unscheduled)
|
||||
self.assertGreater(len(first_child_response['child_info']['children']), 0)
|
||||
|
||||
@@ -395,8 +394,7 @@ class TestCourseOutline(CourseTestCase):
|
||||
self.assertIsNotNone(json_response['display_name'])
|
||||
self.assertIsNotNone(json_response['id'])
|
||||
self.assertIsNotNone(json_response['category'])
|
||||
if not is_concise:
|
||||
self.assertTrue(json_response['published'])
|
||||
self.assertNotEqual(json_response.get('published', False), is_concise)
|
||||
if json_response.get('child_info', None):
|
||||
for child_response in json_response['child_info']['children']:
|
||||
self.assert_correct_json_response(child_response, is_concise)
|
||||
|
||||
Reference in New Issue
Block a user