Ejemplo n.º 1
0
    def test_example(self):
        now = timezone.now()
        reflection = models.Reflection(date=now)
        reflection.save()
        question = models.Question(prompt="hellur", reflection=reflection)
        question.save()
        ids = list(question.reflection.question_set.all().values("id"))
        index = ids.index({"id": question.id})

        self.assertEqual(str(question), f"Question {index + 1}")
Ejemplo n.º 2
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}")
Ejemplo n.º 3
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")
Ejemplo n.º 4
0
    def test_example(self):
        question = models.Question(prompt="hellur")
        test_question = models.QuestionSubmission(question=question)

        self.assertEqual(test_question.question__prompt(),
                         test_question.question.prompt)