Ejemplo n.º 1
0
    def test_solution_notification_deleted(self, get_current, delay):
        """Calling build_solution_notification should not query the
        questions_question table.

        This test attempts to simulate the replication lag presumed to cause
        bug 585029.

        """
        get_current.return_value.domain = 'testserver'

        answer = Answer.objects.get(pk=1)
        question = Question.objects.get(pk=1)
        question.solution = answer
        question.save()

        # Delete the question, pretend it hasn't been replicated yet
        Question.objects.get(pk=question.pk).delete()

        build_solution_notification(question)

        delay.assert_called_with(
            self.ct, question.id,
            u'Solution to: %s' % question.title,
            SOLUTION_EMAIL_OUTSIDE_REQUEST,
            (u'user118533@nowhere',),
            'solution')
Ejemplo n.º 2
0
    def test_solution_notification(self, get_current, delay):
        get_current.return_value.domain = 'testserver'

        answer = Answer.objects.get(pk=1)
        question = answer.question
        question.solution = answer
        question.save()
        build_solution_notification(question)

        delay.assert_called_with(
            self.ct, question.id,
            u'Solution to: %s' % question.title,
            SOLUTION_EMAIL_OUTSIDE_REQUEST,
            (u'user118533@nowhere',),
            'solution')