コード例 #1
0
    def test_with_policy(self):
        from Products.CMFCore.exportimport.cachingpolicymgr import exportCachingPolicyManager

        site = self._initSite(with_policy=True)
        context = DummyExportContext(site)
        exportCachingPolicyManager(context)

        self.assertEqual(len(context._wrote), 1)
        filename, text, content_type = context._wrote[0]
        self.assertEqual(filename, "cachingpolicymgr.xml")
        self._compareDOM(text, self._WITH_POLICY_EXPORT)
        self.assertEqual(content_type, "text/xml")
コード例 #2
0
ファイル: test_cachingpolicymgr.py プロジェクト: dtgit/dtedu
    def test_empty(self):
        from Products.CMFCore.exportimport.cachingpolicymgr \
                import exportCachingPolicyManager

        site = self._initSite(with_policy=False)
        context = DummyExportContext(site)
        exportCachingPolicyManager(context)

        self.assertEqual(len(context._wrote), 1)
        filename, text, content_type = context._wrote[0]
        self.assertEqual(filename, 'cachingpolicymgr.xml')
        self._compareDOM(text, self._EMPTY_EXPORT)
        self.assertEqual(content_type, 'text/xml')
コード例 #3
0
    def test_with_policy(self):
        from Products.CMFCore.exportimport.cachingpolicymgr \
                import exportCachingPolicyManager

        site = self._initSite(with_policy=True)
        context = DummyExportContext(site)
        exportCachingPolicyManager(context)

        self.assertEqual(len(context._wrote), 1)
        filename, text, content_type = context._wrote[0]
        self.assertEqual(filename, 'cachingpolicymgr.xml')
        self._compareDOM(text, self._WITH_POLICY_EXPORT)
        self.assertEqual(content_type, 'text/xml')
コード例 #4
0
    def test_empty(self):
        from Products.CMFCore.exportimport.cachingpolicymgr \
                import exportCachingPolicyManager

        site, _cpm = self._initSite(with_policy=False)
        context = DummyExportContext(site)
        exportCachingPolicyManager(context)

        self.assertEqual(len(context._wrote), 1)
        filename, text, content_type = context._wrote[0]
        self.assertEqual(filename, 'cachingpolicymgr.xml')
        self._compareDOM(text.decode('utf8'), self._EMPTY_EXPORT)
        self.assertEqual(content_type, 'text/xml')