Пример #1
0
    def test_example(self):
        now = timezone.now()
        user = User.objects.create_user("janet")
        reflection = models.Reflection(date=now)
        submission = models.Submission(reflection=reflection, user=user)

        self.assertEqual(str(submission),
                         f"{user.username} | Reflection {reflection.date}")
Пример #2
0
    def test_for_no(self):
        user = User.objects.create_user("janet")
        now = timezone.now()
        reflection = models.Reflection(date=now)
        submission = models.Submission(reflection=reflection, user=user)

        self.client.force_login(user)

        response = self.client.get(reverse("reflections:admin_view"))
        self.assertContains(response, "No")
Пример #3
0
    def test_example(self):
        now = timezone.now()
        user = User.objects.create_user("janet")
        reflection = models.Reflection(date=now)
        submission = models.Submission(reflection=reflection, user=user)
        question = models.Question(prompt="hellur")
        questionsubmission = models.QuestionSubmission(question=question,
                                                       submission=submission,
                                                       answer="Hellor")

        self.assertEqual(str(questionsubmission),
                         f"{questionsubmission.answer}")
Пример #4
0
    def test_successfully(self):
        user = User.objects.create_user("janet")
        user.save()
        reflection = models.Reflection.objects.create(date=timezone.now())
        question = models.Question(prompt="hellur", reflection=reflection)
        question.save()

        submission = models.Submission(reflection=reflection, user=user)
        submission.save()
        questionsubmission = models.QuestionSubmission(question=question,
                                                       submission=submission,
                                                       answer="Hellor")
        questionsubmission.save()

        self.client.force_login(user)

        response = self.client.get(reverse("reflections:submission_detail"))

        self.assertContains(response, "hellur")
        self.assertContains(response, "Hellor")