lundi 1 juin 2015

django test model field

i'm currently writing tests for my django project and i need to make sure

that a specific field of a model is of a certain type.

for example in model Pictures i want to make sure that there is a field with the

name "image" and that he of type ImageField.

i also want to be able to check if an attribute is of type ForeignKey of

model Pictures.

i tried to use the assertIsInstance, but i need to assign the attribute or else

he is None.

does someone know how to do it?

Aucun commentaire:

Enregistrer un commentaire