def test_access_student_progress_ccx(self): """ Assert that only a coach can see progress of student. """ ccx_locator = self.make_ccx() student = UserFactory() # Enroll user CourseEnrollment.enroll(student, ccx_locator) # Test for access of a coach request = self.request_factory.get( reverse('about_course', args=[unicode(ccx_locator)])) request.user = self.coach mako_middleware_process_request(request) resp = views.progress(request, course_id=unicode(ccx_locator), student_id=student.id) self.assertEqual(resp.status_code, 200) # Assert access of a student request = self.request_factory.get( reverse('about_course', args=[unicode(ccx_locator)])) request.user = student mako_middleware_process_request(request) with self.assertRaises(Http404) as context: views.progress(request, course_id=unicode(ccx_locator), student_id=self.coach.id) self.assertIsNotNone(context.exception)
def test_access_student_progress_ccx(self): """ Assert that only a coach can see progress of student. """ ccx_locator = self.make_ccx() student = UserFactory() # Enroll user CourseEnrollment.enroll(student, ccx_locator) # Test for access of a coach request = self.request_factory.get(reverse('about_course', args=[unicode(ccx_locator)])) request.user = self.coach mako_middleware_process_request(request) resp = views.progress(request, course_id=unicode(ccx_locator), student_id=student.id) self.assertEqual(resp.status_code, 200) # Assert access of a student request = self.request_factory.get(reverse('about_course', args=[unicode(ccx_locator)])) request.user = student mako_middleware_process_request(request) with self.assertRaises(Http404) as context: views.progress(request, course_id=unicode(ccx_locator), student_id=self.coach.id) self.assertIsNotNone(context.exception)
def grade_course(self, course_key): """ Renders the progress page for the given course. """ return progress(self.request, course_id=unicode(course_key), student_id=self.student.id)
def grade_course(self, course_key): """ Renders the progress page for the given course. """ return progress( self.request, course_id=unicode(course_key), student_id=self.student.id )
def grade_course(self, course, view_as_ccx): """ Renders the progress page for the given course. """ course_key = course.id if view_as_ccx: course_key = CCXLocator.from_course_locator( course_key, self.ccx.id) return progress(self.request, course_id=unicode(course_key), student_id=self.student.id)
def grade_course(self, course, view_as_ccx): """ Renders the progress page for the given course. """ course_key = course.id if view_as_ccx: course_key = CCXLocator.from_course_locator(course_key, self.ccx.id) return progress( self.request, course_id=unicode(course_key), student_id=self.student.id )