How to unit test Django-CMS extensions?

前端 未结 2 1252
南方客
南方客 2021-02-19 08:55

I am trying to get some test coverage for a Django-CMS implementation I\'m working on and I\'m unsure how to unit test plugins/extensions. Has anyone done this before, and if s

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 09:28

    If I understand your question correctly, you can find examples for unit-tests for plugins in the module cms/tests/plugins.py, located in the folder holding your installation of django-cms.

    Basically you subclass CMSTestCase and use the Client class from django.test.client to make requests to your CMS and check the resulting responses.

    Information on how to use the client can be found on http://docs.djangoproject.com/en/dev/topics/testing/#module-django.test.client

提交回复
热议问题