【发布时间】:2021-07-23 17:37:26
【问题描述】:
我想对test_models.py 进行单元测试,文件内容如下:
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTest(TestCase):
def test_create_user_with_email_successful(self):
email = 'superuser@super.com'
password = '9876543210'
user = get_user_model().objects.create_user(
email=email,
password=password
)
self.assertEqual(user.email, email)
self.assertTrue(user.check_password(password))
在我运行python manage.py test 之后,我得到了这个:
System check identified no issues (0 silenced).
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
【问题讨论】:
标签: django unit-testing django-tests django-3.2