Пример #1
0
 def testCanCommit(self):
     # Additionally, it allows us to commit transactions without
     # harming the test ZODB.
     self.folder.foo = 1
     transaction.commit()
     self.folder.foo = 2
     transaction.commit()
Пример #2
0
 def testCanCommit(self):
     # Additionally, it allows us to commit transactions without
     # harming the test ZODB.
     self.folder.foo = 1
     transaction.commit()
     self.folder.foo = 2
     transaction.commit()
Пример #3
0
    def afterSetUp(self):
        uf = self.folder.acl_users
        uf.userFolderAddUser('manager', 'secret', ['Manager'], [])

        # A simple document
        self.folder.addDTMLDocument('index_html', file='index_html called')

        # A document only accessible to manager
        self.folder.addDTMLDocument('secret_html', file='secret_html called')

        for p in ZopeTestCase.standard_permissions:
            self.folder.secret_html.manage_permission(p, ['Manager'])

        # A method to change the title property of an object
        self.folder.addDTMLMethod(
            'change_title',
            file=
            '''<dtml-call "manage_changeProperties(title=REQUEST.get('title'))">'''
            '''<dtml-var title_or_id>''')

        manager = uf.getUserById('manager').__of__(uf)
        self.folder.change_title.changeOwnership(manager)

        # Commit so the ZServer threads can see the changes
        transaction.commit()
Пример #4
0
    def afterSetUp(self):
        uf = self.folder.acl_users
        uf.userFolderAddUser('manager', 'secret', ['Manager'], [])

        self.folder_url = self.folder.absolute_url()

        # A simple document
        self.folder.addDTMLDocument('index_html', file='index_html called')

        # A document only accessible to manager
        self.folder.addDTMLDocument('secret_html', file='secret_html called')

        for p in ZopeTestCase.standard_permissions:
            self.folder.secret_html.manage_permission(p, ['Manager'])

        # A method to change the title property of an object
        self.folder.addDTMLMethod('change_title', 
            file='''<dtml-call "manage_changeProperties(title=REQUEST.get('title'))">'''
                 '''<dtml-var title_or_id>''')

        manager = uf.getUserById('manager').__of__(uf)
        self.folder.change_title.changeOwnership(manager)

        # Commit so the ZServer threads can see the changes
        transaction.commit()
Пример #5
0
 def test_doPush(self):
     path = '%s/%s' % (self.fol1.getId(), self.doc1.getId())
     # Need a _p_jar in order to sync stuff.
     # Use the subtransaction hack.
     try:
         transaction.commit(1)  # get_ XXX
         # It hasn't been configured yet, so not much happens.
         # We should get empty messages back.
         msgs = self.zs_tool.doPush(path)
         self.assertEqual(msgs, [])
     finally:
         transaction.abort(1)
Пример #6
0
 def test_doPush(self):
     # doPush() requires the "subtransaction hack" to avoid missing
     # _p_ attributes.
     transaction.commit(1)
     try:
         # Try pushing a Missing object, it should no longer be missing.
         missing = self.doc_missing.getId()
         self.failIf(missing in self.fol2.objectIds())
         msgs = self.zs_tool.doPush(missing)
         self.assertEqual(len(msgs), 1)
         self.failIf(msgs[0].status > 200)
         self.failUnless(missing in self.fol2.objectIds())
         # Try pushing an Extra object, this should be not found.
         extra = self.doc_extra.getId()
         self.failIf(extra in self.fol1.objectIds())
         msgs = self.zs_tool.doPush(extra)
         self.assertEqual(len(msgs), 1)
         self.assertEqual(msgs[0].status, 404)
     finally:
         transaction.abort(1)
Пример #7
0
 def tearDown(cls):
     app = ZopeTestCase.app()
     delattr(app, 'LAYER_EXTRACTED')
     transaction.commit()
     ZopeTestCase.close(app)
Пример #8
0
 def setUp(cls):
     app = ZopeTestCase.app()
     app.LAYER_EXTRACTED = True
     transaction.commit()
     ZopeTestCase.close(app)
Пример #9
0
 def _commit(self):
     '''Commits the transaction.'''
     transaction.commit()
Пример #10
0
 def _commit(self):
     """Commits the transaction."""
     transaction.commit()
Пример #11
0
 def setUp(cls):
     app = ZopeTestCase.app()
     app.LAYER_EXTRACTED = True
     transaction.commit()
     ZopeTestCase.close(app)
Пример #12
0
 def cleanup(app):
     app._delObject('dummy1')
     app._delObject('dummy2')
     transaction.commit()
Пример #13
0
 def setup(app):
     app._setObject('dummy1', DummyObject())
     app._setObject('dummy2', DummyObject())
     transaction.commit()
Пример #14
0
 def beforeClose(self):
     # Commit after cleanup
     transaction.commit()
Пример #15
0
 def beforeClose(self):
     # Commit after cleanup
     transaction.commit()
Пример #16
0
 def setup(app):
     app._setObject('dummy1', DummyObject())
     app._setObject('dummy2', DummyObject())
     transaction.commit()
Пример #17
0
 def cleanup(app):
     app._delObject('dummy1')
     app._delObject('dummy2')
     transaction.commit()
Пример #18
0
 def tearDown(cls):
     app = ZopeTestCase.app()
     delattr(app, 'LAYER_EXTRACTED')
     transaction.commit()
     ZopeTestCase.close(app)