Пример #1
0
    def test_checkinObjectLinkedInParentsRichTextField(self):
        """Checnking-in an object that is linked in it's
        parent's rich text field. See: https://dev.plone.org/ticket/13462
        """
        # create a folderish object with a rich text field
        from content import addRichFolder
        addRichFolder(self.portal, 'rich_text_folder')
        rich_text_folder = self.portal.rich_text_folder

        # create the subobject
        rich_text_folder.invokeFactory('Document', 'subobject')
        subobject = rich_text_folder.subobject
        subobject_uid = subobject.UID()

        # link (by uid) the subobject in it's parent's rich text field
        link_html = '<a class="internal-link" href="resolveuid/%s">' \
            'Link to subobject</a>'
        rich_text_folder.setText(link_html % subobject_uid)

        # try to checkout and checkin the subobject
        wc = ICheckinCheckoutPolicy(subobject).checkout(rich_text_folder)
        ICheckinCheckoutPolicy(wc).checkin("updated")

        # everything went right and the working copy is checked in
        self.assertEqual(subobject_uid, wc.UID())