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
        self.assertFalse(
            SurveyAnswer.objects.filter(user=answer.user).exclude(
                field_value='').exists())
Ejemplo n.º 2
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())