我的观点有一个单元测试
class TestFromAllAdd(TestCase):
fixtures = ['staging_accounts_user.json',
'staging_main_category.json',
'staging_main_dashboard.json',
'staging_main_location.json',
'staging_main_product.json',
'staging_main_shoppinglist.json']
def setUp(self):
self.factory = RequestFactory()
self.c = Client()
self.c.login(username='admin', password='admin')
def from_all_products_html404_test(self):
request = self.factory.post('main/adding_from_all_products', {'product_id': ''})
request.user = User.objects.get(username= 'admin')
response = adding_from_all_products(request)
self.assertEqual(response.status_code, 404)
但是我还有几个带有测试的类,我不能同时运行它们:
python manage.py test main
不运行测试,但如果我运行;
python manage.py test main.TestFromAllAdd.from_all_products_html404_test
,运行一个测试;