Example #1
0
    def test_user_not_yet_answered_required_survey(self):
        """
        Assert that a new course which has a required survey but user has not answered it yet
        """
        self.assertTrue(must_answer_survey(self.course, self.student))

        temp_course = CourseFactory.create(course_survey_required=False)
        self.assertFalse(must_answer_survey(temp_course, self.student))

        temp_course = CourseFactory.create(course_survey_required=True,
                                           course_survey_name="NonExisting")
        self.assertFalse(must_answer_survey(temp_course, self.student))
Example #2
0
    def test_user_not_yet_answered_required_survey(self):
        """
        Assert that a new course which has a required survey but user has not answered it yet
        """
        self.assertTrue(must_answer_survey(self.course, self.student))

        temp_course = CourseFactory.create(
            course_survey_required=False
        )
        self.assertFalse(must_answer_survey(temp_course, self.student))

        temp_course = CourseFactory.create(
            course_survey_required=True,
            course_survey_name="NonExisting"
        )
        self.assertFalse(must_answer_survey(temp_course, self.student))
Example #3
0
 def _redirect_if_needed_for_course_survey(self):
     """
     Check to see if there is a required survey that must be taken before
     the user can access the course.
     """
     if must_answer_survey(self.course, self.effective_user):
         raise Redirect(reverse('course_survey', args=[unicode(self.course.id)]))
Example #4
0
 def _redirect_if_needed_for_course_survey(self):
     """
     Check to see if there is a required survey that must be taken before
     the user can access the course.
     """
     if must_answer_survey(self.course, self.effective_user):
         raise Redirect(reverse('course_survey', args=[unicode(self.course.id)]))
Example #5
0
 def test_staff_must_answer_survey(self):
     """
     Assert that someone with staff level permissions does not have to answer the survey
     """
     self.assertFalse(must_answer_survey(self.course, self.staff))
Example #6
0
 def test_user_has_answered_required_survey(self):
     """
     Assert that a new course which has a required survey and user has answers for it
     """
     self.survey.save_user_answers(self.student, self.student_answers)
     self.assertFalse(must_answer_survey(self.course, self.student))
Example #7
0
 def test_user_has_answered_required_survey(self):
     """
     Assert that a new course which has a required survey and user has answers for it
     """
     self.survey.save_user_answers(self.student, self.student_answers)
     self.assertFalse(must_answer_survey(self.course, self.student))
Example #8
0
 def test_staff_must_answer_survey(self):
     """
     Assert that someone with staff level permissions does not have to answer the survey
     """
     self.assertFalse(must_answer_survey(self.course, self.staff))