how do I efficiently test this Django model?

岁酱吖の 提交于 2019-12-06 12:06:45

That's quiet enough. A couple of notes:

  1. No need to delete properties in tearDown
  2. You forgot to tests UserManager in lines raise ValueError using assertRaises.
  3. You may also test that user created by create_user(from UserManager) can authenticate(from django.contrib.auth) by given password and email.
  4. Use coverage package to detect which lines/classes/packages/statements was missed to test.

Hope it helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!