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")
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')
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')
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')