def test_question_can_not_have_eval_field(self): page = QuestionPage.objects.create() rfi = SingleLineText(text="This is a question", page=page) rfi.save() self.assertRaises( ObjectDoesNotExist, lambda: SingleLineText.objects.first().evaluationfield)
def test_question_can_have_eval_field(self): page = QuestionPage.objects.create() rfi = SingleLineText(text="This is a question", page=page) rfi.save() EvaluationField.objects.create(question=rfi) self.assertIsNotNone(EvaluationField.objects.first().question) self.assertIsNotNone(SingleLineText.objects.first().evaluationfield) self.assertEqual(SingleLineText.objects.first().evaluationfield, EvaluationField.objects.first())
def test_evalfield_label_is_non_unique(self): page = QuestionPage.objects.create() q1 = SingleLineText(text="This is a question", page=page) q1.save() EvaluationField.objects.create(question=q1, label="question") q2 = SingleLineText(text="This is also a question", page=page) q2.save() EvaluationField.objects.create(question=q2, label="question") self.assertEqual(EvaluationField.objects.all().count(), 2)
def test_question_can_not_have_eval_field(self): page = QuestionPage.objects.create() rfi = SingleLineText(text="This is a question", page=page) rfi.save() self.assertRaises(ObjectDoesNotExist, lambda: SingleLineText.objects.first().evaluationfield)