def setUp(self): import Products.CMFCore import Products.Five from Products.Five import zcml import Products.GenericSetup PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config("meta.zcml", Products.Five) zcml.load_config("permissions.zcml", Products.Five) zcml.load_config("configure.zcml", Products.GenericSetup) zcml.load_config("configure.zcml", Products.CMFCore) zcml.load_config("configure.zcml", Products.DCWorkflow) factory = self.root.manage_addProduct["CMFDefault"].addConfiguredSite factory("site", "CMFDefault:default", snapshot=False) self.site = self.root.site self.site._setObject("topic", Topic("topic")) self.topic = self.site.topic self.topic.addCriterion("modified", "Friendly Date Criterion") self.topic.addCriterion("portal_type", "String Criterion") type_crit = self.topic.getCriterion("portal_type") type_crit.edit(value="Dummy Content") self.criterion = self.topic.getCriterion("modified") self.now = DateTime() for i in self.day_diffs: dummy_id = "dummy%i" % i self.site._setObject(dummy_id, DummyContent(id=dummy_id, catalog=1)) dummy_ob = getattr(self.site, dummy_id) dummy_ob.modified_date = self.now + i dummy_ob.reindexObject()
def setUp(self): PlacelessSetup.setUp(self) BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup.PluginIndexes) zcml.load_config('configure.zcml', Products.GenericSetup.ZCatalog) zcml.load_config('configure.zcml', Products.GenericSetup.ZCTextIndex)
def setUp(self): import Products.GenericSetup.MailHost PlacelessSetup.setUp(self) BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup.MailHost)
def setUp(self): import Products.CMFCore import Products.Five from Products.Five import zcml import Products.GenericSetup PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite factory('site', 'CMFDefault:default', snapshot=False) self.site = self.root.site self.site._setObject( 'topic', Topic('topic') ) self.topic = self.site.topic self.topic.addCriterion('modified', 'Friendly Date Criterion') self.topic.addCriterion('portal_type', 'String Criterion') type_crit = self.topic.getCriterion('portal_type') type_crit.edit(value='Dummy Content') self.criterion = self.topic.getCriterion('modified') self.now = DateTime() self._old_as_of = _replace_DC__as_of(lambda: self.now) for i in self.day_diffs: dummy_id = 'dummy%i' % i self.site._setObject( dummy_id, DummyContent( id=dummy_id , catalog=1 ) ) dummy_ob = getattr(self.site, dummy_id) dummy_ob.modified_date = self.now + i dummy_ob.reindexObject()
def setUp(self): import Products.CMFCore.exportimport PlacelessSetup.setUp(self) BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
def setUp(self): PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) try: newSecurityManager( None, UnrestrictedUser('manager', '', ['Manager'], [])) factory = self.root.manage_addProduct[ 'CMFDefault'].addConfiguredSite factory('cmf', 'CMFDefault:default', snapshot=False) self.site = self.root.cmf self.site.invokeFactory('File', id='file') self.site.portal_workflow.doActionFor(self.site.file, 'publish') self.site.invokeFactory('Image', id='image') self.site.portal_workflow.doActionFor(self.site.image, 'publish') self.site.invokeFactory('Folder', id='subfolder') self.subfolder = self.site.subfolder self.workflow = self.site.portal_workflow transaction.commit(1) # Make sure we have _p_jars except: self.tearDown() raise
def setUp(self): PlacelessSetup.setUp(self) SecurityRequestTest.setUp(self) self._trap_warning_output() zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore)
def setUp(self): import Products.CMFCore import Products.Five from Products.Five import zcml import Products.GenericSetup PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite factory('site', 'CMFDefault:default', snapshot=False) self.site = self.root.site self.site._setObject('topic', Topic('topic')) self.topic = self.site.topic self.topic.addCriterion('modified', 'Friendly Date Criterion') self.topic.addCriterion('portal_type', 'String Criterion') type_crit = self.topic.getCriterion('portal_type') type_crit.edit(value='Dummy Content') self.criterion = self.topic.getCriterion('modified') self.now = DateTime() for i in self.day_diffs: dummy_id = 'dummy%i' % i self.site._setObject(dummy_id, DummyContent(id=dummy_id, catalog=1)) dummy_ob = getattr(self.site, dummy_id) dummy_ob.modified_date = self.now + i dummy_ob.reindexObject()
def setUp(self): PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) zcml.load_string(_TRAVERSE_ZCML) try: newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], [])) factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite factory('cmf', 'CMFDefault:default', snapshot=False) self.site = self.root.cmf self.site.invokeFactory('File', id='file') self.site.portal_workflow.doActionFor(self.site.file, 'publish') self.site.invokeFactory('Image', id='image') self.site.portal_workflow.doActionFor(self.site.image, 'publish') self.site.invokeFactory('Folder', id='subfolder') self.subfolder = self.site.subfolder self.workflow = self.site.portal_workflow transaction.savepoint(optimistic=True) # Make sure we have _p_jars except: self.tearDown() raise
def setUp(self): PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) zcml.load_string(_TRAVERSE_ZCML) try: factory = self.root.manage_addProduct[ 'CMFDefault'].addConfiguredSite factory('cmf', 'CMFDefault:default', snapshot=False) self.portal = self.root.cmf # Become a Manager self.uf = self.portal.acl_users self.uf.userFolderAddUser('manager', '', ['Manager'], []) self.login('manager') # Make a document self.discussion = self.portal.portal_discussion self.portal.invokeFactory('Document', id='doc') self.discussion.overrideDiscussionFor(self.portal.doc, 1) # Publish it self.workflow = self.portal.portal_workflow self.workflow.doActionFor(self.portal.doc, 'publish') except: self.tearDown() raise
def setUp( self ): PlacelessSetup.setUp(self) SecurityRequestTest.setUp( self ) self._trap_warning_output() zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore)
def setUp(self): PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) zcml.load_string(_TRAVERSE_ZCML) try: factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite factory('cmf', 'CMFDefault:default', snapshot=False) self.portal = self.root.cmf # Become a Manager self.uf = self.portal.acl_users self.uf.userFolderAddUser('manager', '', ['Manager'], []) self.login('manager') # Make a document self.discussion = self.portal.portal_discussion self.portal.invokeFactory('Document', id='doc') self.discussion.overrideDiscussionFor(self.portal.doc, 1) # Publish it self.workflow = self.portal.portal_workflow self.workflow.doActionFor(self.portal.doc, 'publish') except: self.tearDown() raise
def tearDown(self): from AccessControl.SecurityManagement import noSecurityManager if self._finally is not None: self._finally() noSecurityManager() PlacelessSetup.tearDown(self)
def setUp(self): PlacelessSetup.setUp(self) TransactionalTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow)
def setUp(self): PlacelessSetup.setUp(self) SecurityRequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow)
def setUp(self): PlacelessSetup.setUp(self) SecurityRequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) zcml.load_string(_TRAVERSE_ZCML)
def setUp(self): from zope.component import provideHandler from zope.app.event.interfaces import IObjectEvent from Products.CMFCore.interfaces import ICookieCrumbler from Products.CMFCore.CookieCrumbler import handleCookieCrumblerEvent PlacelessSetup.setUp(self) self._finally = None provideHandler(handleCookieCrumblerEvent, adapts=(ICookieCrumbler, IObjectEvent))
def setUp(self): import Products.CMFCore PlacelessSetup.setUp(self) TransactionalTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_string(_TRAVERSE_ZCML) root = self.root root._setObject('portal', DummyContent('portal', 'url_portal')) portal = self.portal = root.portal portal.portal_membership = DummyMembershipTool() self.folder = DummyContent('foo', 'url_foo') self.object = DummyContent('bar', 'url_bar')
def setUp(self): from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI PlacelessSetup.setUp(self) SecurityTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.Five.browser) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_string(_TRAVERSE_ZCML) self.site = DummySite('site').__of__(self.root) self.acl_users = self.site._setObject('acl_users', DummyUserFolder()) self.ttool = self.site._setObject('portal_types', self._makeOne()) fti = FTIDATA_DUMMY[0].copy() self.ttool._setObject('Dummy Content', FTI(**fti))
def setUp( self ): from Products.CMFCore.TypesTool import FactoryTypeInformation as FTI PlacelessSetup.setUp(self) SecurityTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.Five.browser) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_string(_TRAVERSE_ZCML) self.site = DummySite('site').__of__(self.root) self.acl_users = self.site._setObject( 'acl_users', DummyUserFolder() ) self.ttool = self.site._setObject( 'portal_types', self._makeOne() ) fti = FTIDATA_DUMMY[0].copy() self.ttool._setObject( 'Dummy Content', FTI(**fti) )
def setUp(self): PlacelessSetup.setUp(self) BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore)
def tearDown(self): RequestTest.tearDown(self) PlacelessSetup.tearDown(self)
def tearDown(self): noSecurityManager() RequestTest.tearDown(self) PlacelessSetup.tearDown(self)
def setUp(self): from Products.CMFCore import CachingPolicyManager PlacelessSetup.setUp(self) RequestTest.setUp(self) FSDVTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_string(_TRAVERSE_ZCML) now = DateTime() # Create a fake portal and the tools we need self.portal = DummySite(id='portal').__of__(self.root) self.portal._setObject('portal_types', DummyTool()) # This is a FSPageTemplate that will be used as the View for # our content objects. It doesn't matter what it returns. path = os.path.join(self.skin_path_name, 'testPT2.pt') self.portal._setObject('dummy_view', FSPageTemplate('dummy_view', path)) uf = self.root.acl_users password = '******' uf.userFolderAddUser(portal_owner, password, ['Manager'], []) user = uf.getUserById(portal_owner) if not hasattr(user, 'aq_base'): user = user.__of__(uf) newSecurityManager(None, user) owner_auth = '%s:%s' % (portal_owner, password) self.auth_header = "Basic %s" % base64.encodestring(owner_auth) self.portal._setObject('doc1', DummyContent('doc1')) self.portal._setObject('doc2', DummyContent('doc2')) self.portal._setObject('doc3', DummyContent('doc3')) self.portal.doc1.modified_date = now self.portal.doc2.modified_date = now self.portal.doc3.modified_date = now CachingPolicyManager.manage_addCachingPolicyManager(self.portal) cpm = self.portal.caching_policy_manager # This policy only applies to doc1. It will not emit any ETag header # but it enables If-modified-since handling. cpm.addPolicy(policy_id = 'policy_no_etag', predicate = 'python:object.getId()=="doc1"', mtime_func = '', max_age_secs = 0, no_cache = 0, no_store = 0, must_revalidate = 0, vary = '', etag_func = '', enable_304s = 1) # This policy only applies to doc2. It will emit an ETag with # the constant value "abc" and also enable if-modified-since handling. cpm.addPolicy(policy_id = 'policy_etag', predicate = 'python:object.getId()=="doc2"', mtime_func = '', max_age_secs = 0, no_cache = 0, no_store = 0, must_revalidate = 0, vary = '', etag_func = 'string:abc', enable_304s = 1) # This policy only applies to doc3. Etags with constant values of # "abc" are emitted, but if-modified-since handling is turned off. cpm.addPolicy(policy_id = 'policy_disabled', predicate = 'python:object.getId()=="doc3"', mtime_func = '', max_age_secs = 0, no_cache = 0, no_store = 0, must_revalidate = 0, vary = '', etag_func = 'string:abc', enable_304s = 0)
def tearDown(self): SecurityRequestTest.tearDown(self) PlacelessSetup.tearDown(self)
def tearDown(self): BaseRegistryTests.tearDown(self) PlacelessSetup.tearDown(self)
def tearDown( self ): self._free_warning_output() SecurityRequestTest.tearDown( self ) PlacelessSetup.tearDown(self)
def tearDown(self): TransactionalTest.tearDown(self) PlacelessSetup.tearDown(self)
def tearDown(self): SecurityTest.tearDown(self) PlacelessSetup.tearDown(self) self._free_warning_output()
def setUp(self): from Products.CMFCore import CachingPolicyManager PlacelessSetup.setUp(self) RequestTest.setUp(self) FSDVTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_string(_TRAVERSE_ZCML) now = DateTime() # Create a fake portal and the tools we need self.portal = DummySite(id='portal').__of__(self.root) self.portal._setObject('portal_types', DummyTool()) # This is a FSPageTemplate that will be used as the View for # our content objects. It doesn't matter what it returns. path = os.path.join(self.skin_path_name, 'testPT2.pt') self.portal._setObject('dummy_view', FSPageTemplate('dummy_view', path)) uf = self.root.acl_users password = '******' uf.userFolderAddUser(portal_owner, password, ['Manager'], []) user = uf.getUserById(portal_owner) if not hasattr(user, 'aq_base'): user = user.__of__(uf) newSecurityManager(None, user) owner_auth = '%s:%s' % (portal_owner, password) self.auth_header = "Basic %s" % base64.encodestring(owner_auth) self.portal._setObject('doc1', DummyContent('doc1')) self.portal._setObject('doc2', DummyContent('doc2')) self.portal._setObject('doc3', DummyContent('doc3')) self.portal.doc1.modified_date = now self.portal.doc2.modified_date = now self.portal.doc3.modified_date = now CachingPolicyManager.manage_addCachingPolicyManager(self.portal) cpm = self.portal.caching_policy_manager # This policy only applies to doc1. It will not emit any ETag header # but it enables If-modified-since handling. cpm.addPolicy(policy_id='policy_no_etag', predicate='python:object.getId()=="doc1"', mtime_func='', max_age_secs=0, no_cache=0, no_store=0, must_revalidate=0, vary='', etag_func='', enable_304s=1) # This policy only applies to doc2. It will emit an ETag with # the constant value "abc" and also enable if-modified-since handling. cpm.addPolicy(policy_id='policy_etag', predicate='python:object.getId()=="doc2"', mtime_func='', max_age_secs=0, no_cache=0, no_store=0, must_revalidate=0, vary='', etag_func='string:abc', enable_304s=1) # This policy only applies to doc3. Etags with constant values of # "abc" are emitted, but if-modified-since handling is turned off. cpm.addPolicy(policy_id='policy_disabled', predicate='python:object.getId()=="doc3"', mtime_func='', max_age_secs=0, no_cache=0, no_store=0, must_revalidate=0, vary='', etag_func='string:abc', enable_304s=0)
def tearDown(self): RequestTest.tearDown(self) FSDVTest.tearDown(self) PlacelessSetup.tearDown(self)