Re: Unit testing models.py

2018-05-14 Thread Melvyn Sopacua
Hi Mark, On zondag 13 mei 2018 18:11:07 CEST Mark Phillips wrote: > What should be unit tested in models.py? I assume the storing of data and > retrieving of data from the database does not need to be tested, as I > further assume django has a full set of tests for those operations. You should te

Re: Unit testing models.py

2018-05-13 Thread 'Anthony Flury' via Django users
I would agree with that - test any custom functionality - * Custom methods (including __str__ and __repr__) * custom managers * Triggers (that maybe save custom fields on update) * validations - testing to ensure that the right validation is performed on that field - i.e. you linked the ri

Re: Unit testing models.py

2018-05-13 Thread Jani Tiainen
Hi, In general you don't need to test your models if you don't use anything special there. If you do have properties or methods on models that do something that is good to test that they return correct values or do correct things. On Sun, May 13, 2018 at 7:11 PM, Mark Phillips wrote: > What s

Unit testing models.py

2018-05-13 Thread Mark Phillips
What should be unit tested in models.py? I assume the storing of data and retrieving of data from the database does not need to be tested, as I further assume django has a full set of tests for those operations. I can see testing these parts of models.py * All custom methods * Labels for all fie