diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py index d40b3d835a..da40f21ca0 100644 --- a/lms/djangoapps/mobile_api/users/tests.py +++ b/lms/djangoapps/mobile_api/users/tests.py @@ -274,7 +274,6 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest response_discussion_url = response.data[0]['course']['discussion_url'] # pylint: disable=E1101 self.assertIn('/api/discussion/v1/courses/{}'.format(self.course.id), response_discussion_url) - def test_org_query(self): self.login() @@ -289,11 +288,13 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest ] # Enroll in all the courses - self.assertEqual(len(response.data), 3) for course in courses: self.enroll(course.id) - response = self.api_response(data={'org':'edX'}) + response = self.api_response(data={'org': 'edX'}) + + # Test for 3 expected courses + self.assertEqual(len(response.data), 3) # Verify only edX courses are returned for entry in response.data: diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index be31dba4a0..3d8b4fba51 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -271,6 +271,9 @@ class UserCourseEnrollmentsList(generics.ListAPIView): pagination_class = None def is_org(self, check_org, course_org): + """ + Check course org matches request org param or no param provided + """ return check_org is None or (check_org.lower() == course_org.lower()) def get_queryset(self):