Exemplo n.º 1
0
 def test_fields(self):
     ss_content = Question()
     fields = [str(item.attname) for item in ss_content._meta.fields]
     self.assertEqual(9, len(fields))
     for field in [
             'id', 'created', 'modified', 'identifier', 'text',
             'answer_type', 'mandatory', 'qset_id', 'response_validation_id'
     ]:
         self.assertIn(field, fields)
Exemplo n.º 2
0
 def test_variable_name_should_be_unique(self):
     question = Question.objects.create(identifier='143.1',
                                        text="This is a question",
                                        answer_type='Text Answer',
                                        group=self.household_member_group,
                                        batch=self.batch,
                                        module=self.question_mod)
     duplicate_question = Question(identifier='143.1',
                                   text="This is a question",
                                   answer_type='Text Answer',
                                   group=self.household_member_group,
                                   batch=self.batch,
                                   module=self.question_mod)
     self.assertRaises(IntegrityError, duplicate_question.save)