在Django中测试admin.ModelAdmin [英] testing admin.ModelAdmin in django
本文介绍了在Django中测试admin.ModelAdmin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在 admin.py
中找到测试 admin.ModelAdmin
的最佳方法。具体来说,我重写了要测试的 save_model()
函数。根据我所做的研究,发现的唯一解决方案是编写请求/响应测试,然后查询数据库。
I am trying to find out the best way for testing admin.ModelAdmin
in admin.py
. Specifically I am overriding the save_model()
function which I want to test. From the research I have done, the only solution I have found was writing a request/response test and then query the database.
推荐答案
查看Django的 ModelAdminTests
例如。
Check out Django's ModelAdminTests
for examples.
这篇关于在Django中测试admin.ModelAdmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文