def test_Broken_instance___getstate___gives_access_to_its_state(self): from Acquisition import aq_base from OFS.Uninstalled import BrokenClass from OFS.tests import test_Uninstalled import transaction # store an instance tr = ToBreak() tr.id = 'tr' self.app._setObject('tr', tr) # commit to allow access in another connection transaction.commit() # remove class from namespace to ensure broken object del test_Uninstalled.ToBreak # get new connection that will give access to broken object app = base.app() inst = aq_base(app.tr) self.assertTrue(isinstance(inst, BrokenClass)) state = inst.__getstate__() self.assertEqual(state, {'id': 'tr'}) # cleanup app.manage_delObjects('tr') transaction.commit() # check that object is not left over app = base.app() self.assertFalse('tr' in app.objectIds())
def afterSetUp(self): _sentinel1[:] = [] self.anApp = base.app() self.anApp.REQUEST._hold(self.Held())
def afterSetUp(self): self.anApp = base.app() self.anApp.REQUEST._hold(self.Held())