`python-django` 中的 `django.test.APITestCase` 和 `rest_framework.test.TestCase` 有什么区别

what is difference between `django.test.APITestCase` and `rest_framework.test.TestCase` in `python-django`

这些测试的主要区别是什么 类 django.test.TestCaserest_framework.test.APITestCase 。哪个更好地测试我的 views.py ? 你能建议我了解这些的文档吗?

提前谢谢你。 :-)

APITestCase in rest_framework.test是为了测试其余的api。它特定于 api 操作和 api 调用。 Django.test.TestCase 用于测试Django 类.

rest_framework.test.APITestCase 和 django.test.testcases.TestCase 在他们使用的 HTTP 客户端中的区别(来源:github)。

使用 rest_framework APIClient 比使用 Django Client 更容易测试 API。例如,较少使用 json 响应。查看更多:http://www.django-rest-framework.org/api-guide/testing/