I want to test the is_valid portion of a form’s validation logic. In my test driver I have:
test_animal = Animal(name="cat", number_paws="4") test_animal_form = AnimalForm(instance=test_animal) assertEqual(test_animal_form.is_valid(), True)
The assertion fails, but from what I see there shouldn’t be any errors in the form. I don’t see any validation errors in the form. Should this work as a test case if the test_animal instance when loaded into the form should validate?
The reason you’re seeing the validation errors is because
instancedata isn’t used in validation, you have to specify the data being sent to the form.