コード例 #1
0
ファイル: test_FSSecurity.py プロジェクト: goschtl/zope
 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 )
コード例 #2
0
 def setUp(self):
     FSDVTest.setUp(self)
     self.app = makerequest(Zope.app())
     self._registerDirectory()
     ob = self.ob = self.app
     addDirectoryViews(ob, self._skinname, self.tempname)
     self.r = self.app.REQUEST
     self.r.other['URL1'] = 'http://foo/test_mt'
     self._add= self.app.manage_addProduct['MailTemplates'].addMailTemplate
     self.folder = Folder('folder')
     if getattr(self.app,'test_mt',None):
         self.app.manage_delObjects(ids=['test_mt'])
     if getattr(self.app,'MailHost',None):
         self.app.manage_delObjects(ids=['MailHost'])
     self.MailHost = self.app.MailHost = DummyMailHost()
     newSecurityManager( None, SystemUser )
コード例 #3
0
 def setUp(self):
     FSDVTest.setUp(self)
     self.app = makerequest(Zope.app())
     self._registerDirectory()
     ob = self.ob = self.app
     addDirectoryViews(ob, self._skinname, self.tempname)
     self.r = self.app.REQUEST
     self.r.other["URL1"] = "http://foo/test_mt"
     self._add = self.app.manage_addProduct["MailTemplates"].addMailTemplate
     self.folder = Folder("folder")
     if getattr(self.app, "test_mt", None):
         self.app.manage_delObjects(ids=["test_mt"])
     if getattr(self.app, "MailHost", None):
         self.app.manage_delObjects(ids=["MailHost"])
     self.MailHost = self.app.MailHost = DummyMailHost()
     newSecurityManager(None, SystemUser)
コード例 #4
0
ファイル: test_DirectoryView.py プロジェクト: goschtl/zope
    def setUp( self ):
        FSDVTest.setUp(self)
        self.test1path = join(self.skin_path_name,'test1.py')
        self.test2path = join(self.skin_path_name,'test2.py')
        self.test3path = join(self.skin_path_name,'test3')

        # initialise skins
        self._registerDirectory(self)

        # add a method to the fake skin folder
        self._writeFile(self.test2path, "return 'test2'")

        # edit the test1 method
        self._writeFile(self.test1path, "return 'new test1'")

        # add a new folder
        mkdir(self.test3path)
コード例 #5
0
 def setUp(self):
     FSDVTest.setUp(self)
     SecurityTest.setUp(self)
コード例 #6
0
ファイル: test_DirectoryView.py プロジェクト: goschtl/zope
 def setUp( self ):
     FSDVTest.setUp(self)
     self.manual_ign = ('CVS', 'SVN', 'test_manual_ignore.py')
     self._registerDirectory(self , ignore=self.manual_ign)
コード例 #7
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)
コード例 #8
0
ファイル: test_FSImage.py プロジェクト: goschtl/zope
 def setUp(self):
     TransactionalTest.setUp(self)
     FSDVTest.setUp(self)
コード例 #9
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)
コード例 #10
0
ファイル: test_FSReSTMethod.py プロジェクト: goschtl/zope
 def setUp(self):
     from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
     FSDVTest.setUp(self)
     main = ZopePageTemplate('main_template', _TEST_MAIN_TEMPLATE)
     self.root._setOb('main_template', main)
コード例 #11
0
 def setUp(self):
     FSDVTest.setUp(self)
     RequestTest.setUp(self)
コード例 #12
0
    def setUp(self):
        from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate

        FSDVTest.setUp(self)
        main = ZopePageTemplate('main_template', _TEST_MAIN_TEMPLATE)
        self.app._setOb('main_template', main)
コード例 #13
0
 def setUp(self):
     FSDVTest.setUp(self)
     self._registerDirectory(self)
コード例 #14
0
 def setUp(self):
     FSDVTest.setUp(self)
     self.manual_ign = ('CVS', 'SVN', 'test_manual_ignore.py')
     self._registerDirectory(self, ignore=self.manual_ign)
コード例 #15
0
 def setUp( self ):
     FSDVTest.setUp(self)
     SecurityTest.setUp( self )
コード例 #16
0
ファイル: test_FSFile.py プロジェクト: goschtl/zope
 def setUp(self):
     FSDVTest.setUp(self)
     RequestTest.setUp(self)
コード例 #17
0
ファイル: test_FSZSQLMethod.py プロジェクト: goschtl/zope
 def setUp(self):
     FSDVTest.setUp(self)
     self._registerDirectory(self)
コード例 #18
0
 def setUp(self):
     TransactionalTest.setUp(self)
     FSDVTest.setUp(self)