Commit bfeeeff7 by Mushtaq Ali

Fix format parameter and test

parent 1b011af7
...@@ -336,7 +336,7 @@ def _course_outline_json(request, course_module): ...@@ -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. 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' include_children_predicate = lambda xblock: not xblock.category == 'vertical'
if is_concise: if is_concise:
include_children_predicate = lambda xblock: xblock.has_children include_children_predicate = lambda xblock: xblock.has_children
......
...@@ -369,9 +369,8 @@ class TestCourseOutline(CourseTestCase): ...@@ -369,9 +369,8 @@ class TestCourseOutline(CourseTestCase):
self.assertEqual(json_response['category'], 'course') self.assertEqual(json_response['category'], 'course')
self.assertEqual(json_response['id'], unicode(self.course.location)) self.assertEqual(json_response['id'], unicode(self.course.location))
self.assertEqual(json_response['display_name'], self.course.display_name) self.assertEqual(json_response['display_name'], self.course.display_name)
if not is_concise: self.assertNotEqual(json_response.get('published', False), is_concise)
self.assertTrue(json_response['published']) self.assertIsNone(json_response.get('visibility_state'))
self.assertIsNone(json_response['visibility_state'])
# Now verify the first child # Now verify the first child
children = json_response['child_info']['children'] children = json_response['child_info']['children']
...@@ -380,8 +379,8 @@ class TestCourseOutline(CourseTestCase): ...@@ -380,8 +379,8 @@ class TestCourseOutline(CourseTestCase):
self.assertEqual(first_child_response['category'], 'chapter') self.assertEqual(first_child_response['category'], 'chapter')
self.assertEqual(first_child_response['id'], unicode(self.chapter.location)) self.assertEqual(first_child_response['id'], unicode(self.chapter.location))
self.assertEqual(first_child_response['display_name'], 'Week 1') self.assertEqual(first_child_response['display_name'], 'Week 1')
self.assertNotEqual(json_response.get('published', False), is_concise)
if not is_concise: if not is_concise:
self.assertTrue(json_response['published'])
self.assertEqual(first_child_response['visibility_state'], VisibilityState.unscheduled) self.assertEqual(first_child_response['visibility_state'], VisibilityState.unscheduled)
self.assertGreater(len(first_child_response['child_info']['children']), 0) self.assertGreater(len(first_child_response['child_info']['children']), 0)
...@@ -395,8 +394,7 @@ class TestCourseOutline(CourseTestCase): ...@@ -395,8 +394,7 @@ class TestCourseOutline(CourseTestCase):
self.assertIsNotNone(json_response['display_name']) self.assertIsNotNone(json_response['display_name'])
self.assertIsNotNone(json_response['id']) self.assertIsNotNone(json_response['id'])
self.assertIsNotNone(json_response['category']) self.assertIsNotNone(json_response['category'])
if not is_concise: self.assertNotEqual(json_response.get('published', False), is_concise)
self.assertTrue(json_response['published'])
if json_response.get('child_info', None): if json_response.get('child_info', None):
for child_response in json_response['child_info']['children']: for child_response in json_response['child_info']['children']:
self.assert_correct_json_response(child_response, is_concise) self.assert_correct_json_response(child_response, is_concise)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment