Ejemplo n.º 1
0
    def setUp(self):
        RequestTest.setUp(self)
        try:

            # Set up a portal
            self.root.manage_addProduct['CMFDefault'].manage_addCMFSite('cmf')
            self.portal = self.root.cmf

            # Set up a manager user
            self.uf = self.portal.acl_users
            self.uf.userFolderAddUser('manager', '', ['Manager'], [])
            self.login('manager')

            # Make a string property we want to acquire later
            self.portal.manage_addProperty(id='simple_type', type='string', value='a string')

            # Make the objects we want to acquire from
            self.portal._setObject('allowed', AllowedItem())
            self.portal._setObject('denied', DeniedItem())
            self.portal._setObject('protected', ProtectedItem())

            # Make a script that calls getToolByName
            self._makePS(self.portal, 'get_tool_by_name', params, body)

        except:
            self.tearDown()
            raise
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
    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()
Ejemplo n.º 6
0
 def setUp(self):
     RequestTest.setUp(self)
     try:
         newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], []))
         self.root.manage_addProduct['CMFDefault'].manage_addCMFSite('cmf')
         self.site = self.root.cmf
         transaction.commit(1) # Make sure we have _p_jars
     except:
         self.tearDown()
         raise
Ejemplo n.º 7
0
 def setUp( self ):
     # initialise skins
     FSDVTest.setUp(self)
     self._registerDirectory(self)
     # set up ZODB
     RequestTest.setUp(self)
     # put object in ZODB
     root=self.root
     try: root._delObject('fake_skin')
     except AttributeError: pass
     root._setObject( 'fake_skin', self.ob.fake_skin )
Ejemplo n.º 8
0
    def setUp(self):
        import Products.CMFCore
        RequestTest.setUp(self)
        setUpTraversing()
        zcml.load_config('permissions.zcml', Products.Five)
        zcml.load_config('configure.zcml', Products.CMFCore)

        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')
Ejemplo n.º 9
0
 def setUp(self):
     RequestTest.setUp(self)
     try:
         self.root.manage_addProduct['CMFDefault'].manage_addCMFSite('cmf')
         self.portal = self.root.cmf
         # Make us a Member
         self.uf = self.portal.acl_users
         self.uf.userFolderAddUser('member', '', ['Member'], [])
         newSecurityManager(None, self.uf.getUserById('member').__of__(self.uf))
         # Make our objects
         self.portal._setObject('allowed', AllowedItem())
         self.portal._setObject('denied', DeniedItem())
     except:
         self.tearDown()
         raise
Ejemplo n.º 10
0
 def setUp(self):
     RequestTest.setUp(self)
     try:
         newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], []))
         self.root.manage_addProduct['CMFDefault'].manage_addCMFSite('cmf')
         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
Ejemplo n.º 11
0
 def setUp(self):
     RequestTest.setUp(self)
     try:
         self.root.manage_addProduct['CMFDefault'].manage_addCMFSite('cmf')
         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
Ejemplo n.º 12
0
    def setUp(self):
        RequestTest.setUp(self)
        self.root.manage_addProduct[ 'CMFDefault' ].manage_addCMFSite( 'site' )
        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()
Ejemplo n.º 13
0
    def setUp(self):
        RequestTest.setUp(self)
        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()
Ejemplo n.º 14
0
 def tearDown(self):
     noSecurityManager()
     RequestTest.tearDown(self)
Ejemplo n.º 15
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSDVTest.tearDown(self)
Ejemplo n.º 16
0
 def setUp(self):
     _TemplateSwitcher.setUp(self)
     RequestTest.setUp(self)
     FSSTXMaker.setUp(self)
Ejemplo n.º 17
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSSTXMaker.tearDown(self)
     self._setWhichTemplate(self._old_STX_TEMPLATE)
Ejemplo n.º 18
0
 def setUp(self):
     RequestTest.setUp(self)
     self.site = DummySite('site').__of__(self.root)
Ejemplo n.º 19
0
 def setUp(self):
     RequestTest.setUp(self)
     FSReSTMaker.setUp(self)
Ejemplo n.º 20
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSDTMLMaker.tearDown(self)
Ejemplo n.º 21
0
 def setUp(self):
     FSPTMaker.setUp(self)
     RequestTest.setUp(self)
Ejemplo n.º 22
0
 def setUp(self):
     RequestTest.setUp(self)
     self.site = DummySite('site').__of__(self.root)
Ejemplo n.º 23
0
 def setUp(self):
     FSDTMLMaker.setUp(self)
     RequestTest.setUp(self)
Ejemplo n.º 24
0
    def setUp(self):
        RequestTest.setUp(self)
        FSDVTest.setUp(self)

        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)
Ejemplo n.º 25
0
 def tearDown(self):
     cleanUp()
     RequestTest.tearDown(self)
Ejemplo n.º 26
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSPTMaker.tearDown(self)
Ejemplo n.º 27
0
 def tearDown(self):
     RequestTest.tearDown(self)
     PlacelessSetup.tearDown(self)
Ejemplo n.º 28
0
 def setUp(self):
     FSDVTest.setUp(self)
     RequestTest.setUp(self)
Ejemplo n.º 29
0
 def setUp(self):
     FSDTMLMaker.setUp(self)
     RequestTest.setUp(self)
Ejemplo n.º 30
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSDVTest.tearDown(self)
Ejemplo n.º 31
0
 def setUp(self):
     FSPTMaker.setUp(self)
     RequestTest.setUp(self)
Ejemplo n.º 32
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSSTXMaker.tearDown(self)
     self._setWhichTemplate(self._old_STX_TEMPLATE)
Ejemplo n.º 33
0
 def tearDown(self):
     FSReSTMaker.tearDown(self)
     RequestTest.tearDown(self)
Ejemplo n.º 34
0
 def tearDown(self):
     FSSTXMaker.tearDown(self)
     RequestTest.tearDown(self)
     _TemplateSwitcher.tearDown(self)
Ejemplo n.º 35
0
 def tearDown(self):
     noSecurityManager()
     RequestTest.tearDown(self)
     PlacelessSetup.tearDown(self)
Ejemplo n.º 36
0
 def setUp(self):
     _TemplateSwitcher.setUp(self)
     RequestTest.setUp(self)
     FSSTXMaker.setUp(self)
Ejemplo n.º 37
0
 def tearDown(self):
     FSSTXMaker.tearDown(self)
     RequestTest.tearDown(self)
     _TemplateSwitcher.tearDown(self)
Ejemplo n.º 38
0
 def tearDown(self):
     noSecurityManager()
     RequestTest.tearDown(self)
     PlacelessSetup.tearDown(self)
Ejemplo n.º 39
0
 def tearDown(self):
     RequestTest.tearDown(self)
     WritableFSDVTest.tearDown(self)
     self._ignore_log_errors()
     self._ignore_log_errors(subsystem='CMFCore.DirectoryView')
Ejemplo n.º 40
0
 def tearDown(self):
     noSecurityManager()
     RequestTest.tearDown(self)
     cleanUp()
Ejemplo n.º 41
0
 def setUp(self):
     FSDVTest.setUp(self)
     RequestTest.setUp(self)
Ejemplo n.º 42
0
 def setUp(self):
     RequestTest.setUp(self)
     self.d = Document('foo')
Ejemplo n.º 43
0
 def setUp(self):
     RequestTest.setUp(self)
     self.site = DummySite('site').__of__(self.root)
     self.site._setObject('portal_membership', DummyTool())
Ejemplo n.º 44
0
 def tearDown(self):
     cleanUp()
     RequestTest.tearDown(self)
Ejemplo n.º 45
0
 def setUp(self):
     RequestTest.setUp(self)
     self.site = DummySite('site').__of__(self.root)
     self.site._setObject( 'portal_membership', DummyTool() )
Ejemplo n.º 46
0
 def tearDown(self):
     PlacelessSetup.tearDown(self)
     RequestTest.tearDown(self)
     FSSTXMaker.tearDown(self)
     _TemplateSwitcher.tearDown(self)
Ejemplo n.º 47
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSDTMLMaker.tearDown(self)
Ejemplo n.º 48
0
 def setUp(self):
     _TemplateSwitcher.setUp(self)
     FSSTXMaker.setUp(self)
     RequestTest.setUp(self)
     PlacelessSetup.setUp(self)
Ejemplo n.º 49
0
 def tearDown(self):
     RequestTest.tearDown(self)
     FSPTMaker.tearDown(self)
Ejemplo n.º 50
0
 def tearDown(self):
     RequestTest.tearDown(self)
     PlacelessSetup.tearDown(self)