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 <m...@phillipsmarketing.biz> 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. > > I can see testing these parts of models.py > > * All custom methods > > * Labels for all fields > something like > def test_first_name_label(self): > author=Author.objects.get(id=1) > field_label = author._meta.get_field('first_name').verbose_name > self.assertEquals(field_label,'first name') > > * Field attributes (eg length of CharField)? Is this really necessary, as > I would again assume django covers this in their unit tests? > > Anything else that I am missing? > > Thanks! > > Mark > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/CAEqej2P0_sZt2j06nf0OnOL%2BE% > 3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAEqej2P0_sZt2j06nf0OnOL%2BE%3DuVa1Cs0BOFmTx8vjQm6-io2Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Jani Tiainen - Well planned is half done, and a half done has been sufficient before... -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHn91oeJYPGbLaJAZbJqd3jxbDcY6m3d8e2fSE06_E_ZwXXosQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.