def test_validation_error_field_type(self): """ Test the validation of model. """ data = { 'is_active': FuzzyText().fuzz(), } customer = Customer(**data) try: customer.full_clean() except ValidationError as e: for key, _ in data.items(): self.assertTrue(key in e.message_dict)
def test_validation_error_field_value_out_of_scope(self): """ Test the validation of model with the field value out of scope. """ data = { 'name': FuzzyText('', 200).fuzz(), 'email': None, 'is_active': FuzzyText().fuzz(), } customer = Customer(**data) try: customer.full_clean() except ValidationError as e: for key, _ in data.items(): self.assertTrue(key in e.message_dict)