feat: list courses details by keys

This adds the ability to get a list of detailed courses based on their
keys provided in the newly added `keys` query param in the `GET /courses/v1/courses/`
endpoint.
This commit is contained in:
Yusuf Musleh
2023-06-26 13:22:36 +03:00
parent cd6c754198
commit 4ad8ba1b41
9 changed files with 97 additions and 11 deletions

View File

@@ -71,6 +71,7 @@ class TestCourseListGetForm(FormTestMixin, UsernameTestMixin, SharedModuleStoreT
'filter_': None,
'permissions': set(),
'active_only': None,
'course_keys': set(),
}
def test_basic(self):
@@ -100,6 +101,14 @@ class TestCourseListGetForm(FormTestMixin, UsernameTestMixin, SharedModuleStoreT
self.assert_valid(self.cleaned_data)
def test_invalid_course_keys(self):
"""
Verify form checks for validity of course keys provided
"""
self.form_data['course_keys'] = 'course-v1:edX+DemoX+Demo_Course,invalid_course_key'
self.assert_error('course_keys', "'invalid_course_key' is not a valid course key.")
class TestCourseIdListGetForm(FormTestMixin, UsernameTestMixin, SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
FORM_CLASS = CourseIdListGetForm