def test_get_course_info(self, course_modes): self._create_course_modes(course_modes, course=self.course) result_course = data.get_course_enrollment_info(unicode( self.course.id)) result_slugs = [mode['slug'] for mode in result_course['course_modes']] for course_mode in course_modes: self.assertIn(course_mode, result_slugs)
def assert_enrollment_modes(self, expected_modes, include_expired): """Get enrollment data and assert response with expected modes.""" result_course = data.get_course_enrollment_info(unicode(self.course.id), include_expired=include_expired) result_slugs = [mode['slug'] for mode in result_course['course_modes']] for course_mode in expected_modes: self.assertIn(course_mode, result_slugs) if not include_expired: self.assertNotIn('verified', result_slugs)
def test_non_existent_course(self): data.get_course_enrollment_info("this/is/bananas")
def test_get_course_info(self, course_modes): self._create_course_modes(course_modes, course=self.course) result_course = data.get_course_enrollment_info(unicode(self.course.id)) result_slugs = [mode['slug'] for mode in result_course['course_modes']] for course_mode in course_modes: self.assertIn(course_mode, result_slugs)
def test_non_existent_course(self): with pytest.raises(CourseNotFoundError): data.get_course_enrollment_info("this/is/bananas")