Ejemplo n.º 1
0
    def test_success_answers_exist(self):
        """
        Basic success path for users that have answers in the table
        """
        answer = SurveyAnswerFactory(field_value="test value")

        _listen_for_lms_retire(sender=self.__class__, user=answer.user)

        # All values for this user should now be empty string
        assert not SurveyAnswer.objects.filter(user=answer.user).exclude(field_value='').exists()
Ejemplo n.º 2
0
    def test_success_answers_exist(self):
        """
        Basic success path for users that have answers in the table
        """
        answer = SurveyAnswerFactory(field_value="test value")

        _listen_for_lms_retire(sender=self.__class__, user=answer.user)

        # All values for this user should now be empty string
        self.assertFalse(SurveyAnswer.objects.filter(user=answer.user).exclude(field_value='').exists())
Ejemplo n.º 3
0
    def test_idempotent(self):
        """
        Tests that re-running a retirement multiple times does not throw an error
        """
        answer = SurveyAnswerFactory(field_value="test value")

        # Run twice to make sure no errors are raised
        _listen_for_lms_retire(sender=self.__class__, user=answer.user)
        fake_completed_retirement(answer.user)
        _listen_for_lms_retire(sender=self.__class__, user=answer.user)

        # All values for this user should still be here and just be an empty string
        assert not SurveyAnswer.objects.filter(user=answer.user).exclude(field_value='').exists()
Ejemplo n.º 4
0
    def test_idempotent(self):
        """
        Tests that re-running a retirement multiple times does not throw an error
        """
        answer = SurveyAnswerFactory(field_value="test value")

        # Run twice to make sure no errors are raised
        _listen_for_lms_retire(sender=self.__class__, user=answer.user)
        fake_completed_retirement(answer.user)
        _listen_for_lms_retire(sender=self.__class__, user=answer.user)

        # All values for this user should still be here and just be an empty string
        self.assertFalse(SurveyAnswer.objects.filter(user=answer.user).exclude(field_value='').exists())
Ejemplo n.º 5
0
 def test_success_no_answers(self):
     """
     Basic success path for users who have no answers, should simply not error
     """
     user = UserFactory()
     _listen_for_lms_retire(sender=self.__class__, user=user)
Ejemplo n.º 6
0
 def test_success_no_answers(self):
     """
     Basic success path for users who have no answers, should simply not error
     """
     user = UserFactory()
     _listen_for_lms_retire(sender=self.__class__, user=user)