test_api.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:DjangoCMS 作者: farhan711 项目源码 文件源码
def test_create_with_revision_fail(self):
        # tests that we're unable to create a page or title
        # through the api with the revision option if reversion
        # is not installed.
        page_attrs = self._get_default_create_page_arguments()
        page_attrs['language'] = 'en'
        page_attrs['with_revision'] = True

        apps = list(settings.INSTALLED_APPS)
        apps.remove('reversion')

        with self.settings(INSTALLED_APPS=apps):
            with self.assertRaises(ImproperlyConfigured):
                create_page(**page_attrs)

        page = create_page(**page_attrs)

        with self.settings(INSTALLED_APPS=apps):
            with self.assertRaises(ImproperlyConfigured):
                create_title('de', 'test de', page, with_revision=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号