python - 在 django 中对抽象 View 进行单元测试

标签 python django unit-testing django-views django-class-based-views

有没有一种方法可以测试抽象(基于类的) View ,即没有实际 urlconf 链接的 View ?例如,Django 本身附带的通用 View 的单元测试。

最佳答案

给你:https://github.com/django/django/tree/master/tests/generic_views

测试方法似乎不是像抽象 View 是 View 那样进行测试,而是将抽象 View 作为单独的单元来测试贡献的功能。

关于python - 在 django 中对抽象 View 进行单元测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9678241/

相关文章:

python - Flask 蓝图将对象传递到另一个文件

python - 如何使用正则表达式搜索字符串中的 2-9 位数字?

python - 在基于类的 View 中返回 template_name + args

ruby-on-rails - 如果我已经有一个没有任何测试的大型代码库,如何开始编写测试?

python - 调用 UnderArmour api 时出现 Developer Inactive 错误

python - 搜索可用于期望最大化(EM)算法的 python 源代码?

django - 来自数据字典的值 : hard to understand

python - django 模型的字段包括其他对象的属性

javascript - Angular Controller Mock 在我的 Mocha 测试中没有持续存在

flutter - Flutter 中 Mockito 缺少 stub 错误。尝试使用 Dio 的帖子