def test_baselineNoCopyReferences(self): # ensure that custom state is maintained with the no copy adapter # setup the named ref adapter from zope import component from Products.Archetypes.interfaces import IBaseObject from plone.app.iterate import relation, interfaces from plone.app.iterate.tests.utils import CustomReference component.provideAdapter(adapts=(IBaseObject, ), provides=interfaces.ICheckinCheckoutReference, factory=relation.NoCopyReferenceAdapter, name="zebra") doc = self.portal.docs.doc1 ref = doc.addReference(self.portal.docs, "zebra", referenceClass=CustomReference) ref.custom_state = "hello world" wc = ICheckinCheckoutPolicy(doc).checkout(self.portal.workarea) self.assertEqual(len(wc.getReferences("zebra")), 0) doc = ICheckinCheckoutPolicy(wc).checkin("updated") self.assertEqual(len(doc.getReferences("zebra")), 1) ref = doc.getReferenceImpl("zebra")[0] self.assert_(hasattr(ref, "custom_state")) self.assertEqual(ref.custom_state, "hello world")
def test_baselineNoCopyReferences(self): # ensure that custom state is maintained with the no copy adapter # setup the named ref adapter from zope import component from Products.Archetypes.interfaces import IBaseObject from plone.app.iterate import relation, interfaces from plone.app.iterate.tests.utils import CustomReference component.provideAdapter( adapts=(IBaseObject,), provides=interfaces.ICheckinCheckoutReference, factory=relation.NoCopyReferenceAdapter, name="zebra") doc = self.portal.docs.doc1 ref = doc.addReference( self.portal.docs, "zebra", referenceClass=CustomReference) ref.custom_state = "hello world" wc = ICheckinCheckoutPolicy(doc).checkout(self.portal.workarea) self.assertEqual(len(wc.getReferences("zebra")), 0) doc = ICheckinCheckoutPolicy(wc).checkin("updated") self.assertEqual(len(doc.getReferences("zebra")), 1) ref = doc.getReferenceImpl("zebra")[0] self.assert_(hasattr(ref, "custom_state")) self.assertEqual(ref.custom_state, "hello world")