def test_feedback_display_text(self): """ If feedback exists for an attempt, return the feedback text. """ feedback_text = 'Feedback text' FeedbackFactory.create(attempt=self.attempt, text=feedback_text) eq_(self.attempt.feedback_display, feedback_text)
def test_attempt_with_feedback_raises_404(self): """ If the current user has an attempt but feedback has already been provided, return a 404. """ user = UserFactory.create() attempt = TaskAttemptFactory.create(user=user, state=TaskAttempt.FINISHED) FeedbackFactory.create(attempt=attempt) request = Mock(user=UserFactory.create()) with self.assertRaises(Http404): self.view.dispatch(request, pk=attempt.pk)
def test_has_feedback_true(self): """ If feedback exists return True. """ FeedbackFactory.create(attempt=self.attempt) eq_(self.attempt.has_feedback, True)