草庐IT

APITestCase

全部标签

python - 将 APITestCase 与 django-rest-framework 一起使用

我遵循了这段代码:fromdjango.core.urlresolversimportreversefromrest_frameworkimportstatusfromrest_framework.testimportAPITestCaseclassAccountTests(APITestCase):deftest_create_account(self):"""Ensurewecancreateanewaccountobject."""url=reverse('account-list')data={'name':'DabApps'}response=self.client.post