feat: Adds course_run field to CourseInformationSerializer v2

Adds sort_order field to tabs JSON in the tabs list in CourseInformationSerializer v2 serializer

Move course_run below course_number and also move the serializer method.

Auto-format removing extraneous white space.

Add trailing commas to the instructor course tabs list to improve the diff going forward.

Add comment about sort order
This commit is contained in:
Brian Buck
2025-12-03 11:42:16 -07:00
parent 70ea641c99
commit 81bdfdd8d2
3 changed files with 125 additions and 10 deletions

View File

@@ -110,6 +110,7 @@ class CourseMetadataViewTest(SharedModuleStoreTestCase):
self.assertEqual(data['display_name'], 'Demonstration Course')
self.assertEqual(data['org'], 'edX')
self.assertEqual(data['course_number'], 'DemoX')
self.assertEqual(data['course_run'], 'Demo_Course')
self.assertEqual(data['pacing'], 'instructor')
# Verify enrollment counts structure
@@ -346,6 +347,16 @@ class CourseMetadataViewTest(SharedModuleStoreTestCase):
tab_ids = [tab['tab_id'] for tab in tabs]
self.assertIn('certificates', tab_ids)
def test_tabs_have_sort_order(self):
"""
Test that all tabs include a sort_order field.
"""
tabs = self._get_tabs_from_response(self.staff)
for tab in tabs:
self.assertIn('sort_order', tab)
self.assertIsInstance(tab['sort_order'], int)
def test_disable_buttons_false_for_small_course(self):
"""
Test that disable_buttons is False for courses with <=200 enrollments.