def test_clone_revision(self):
        """ The clone revision """
        revision1 = self._revision1()
        revision1_info = self._revision1_info()
        revision11 = revision1['1']

        self.assertEquals('4', revision1_info.next_code())
        self.assertFalse('4' in revision1.objectIds())

        latest = revision1_info.latest()

        from zope.component import getMultiAdapter
        view = getMultiAdapter((revision11, revision11.REQUEST), name='clone_revision')
        view()

        self.assertEquals('5', revision1_info.next_code())
        self.assertTrue('4' in revision1.objectIds())

        # ok, we have a cloned revision, let's see if all it's ok
        cloned_revision = revision1['4']
        from redomino.revision.interfaces import IRevisionFile
        IRevisionFile.providedBy(cloned_revision)

        # metadata ok?
        self.assertEquals(revision11.Title(), cloned_revision.Title())
        self.assertEquals(revision11.Description(), cloned_revision.Description())
        self.assertEquals(revision11.Subject(), cloned_revision.Subject())
        self.assertEquals(revision11.getRelatedItems(), cloned_revision.getRelatedItems())
        self.assertNotEquals(revision11.effective(), cloned_revision.effective())

        # latest ok?
        self.assertEquals(latest, revision1_info.latest())
        self.assertTrue(latest is not cloned_revision)
예제 #2
0
 def referred_by(self):
     """ Other revision files (IRevisionFile) that refer this document """
     referrers = [item for item in self.context.getBRefs('relatesTo') if IRevisionFile.providedBy(item)]
     return referrers
예제 #3
0
 def referring(self):
     """ Other revision files (IRevisionFile) related by this document """
     referring = [item for item in self.context.getRelatedItems() if IRevisionFile.providedBy(item)]
     return referring