Esempio n. 1
0
    def testMigrateTypeIcons(self):
        """
        FTIs having content_icon should be upgraded to icon_expr.
        """
        tt = getToolByName(self.portal, "portal_types")
        del tt.Document.icon_expr
        tt.Document.content_icon = 'document_icon.gif'
        migrateTypeIcons(self.portal)
        self.assertEqual(tt.Document.icon_expr,
                         "string:${portal_url}/document_icon.gif")
        self.assertTrue(hasattr(tt.Document, 'icon_expr_object'))

        #Don't upgrade if there is already an icon_expr.
        tt.Document.icon_expr = "string:${portal_url}/document_icon.png"
        tt.Document.content_icon = 'document_icon.gif'
        migrateTypeIcons(self.portal)
        self.assertEqual(tt.Document.icon_expr,
                         "string:${portal_url}/document_icon.png")
Esempio n. 2
0
    def testMigrateTypeIcons(self):
        """
        FTIs having content_icon should be upgraded to icon_expr.
        """
        tt = getToolByName(self.portal, "portal_types")
        del tt.Document.icon_expr
        tt.Document.content_icon = 'document_icon.gif'
        migrateTypeIcons(self.portal)
        self.assertEqual(tt.Document.icon_expr,
                         "string:${portal_url}/document_icon.gif")
        self.assertTrue(hasattr(tt.Document, 'icon_expr_object'))

        #Don't upgrade if there is already an icon_expr.
        tt.Document.icon_expr = "string:${portal_url}/document_icon.png"
        tt.Document.content_icon = 'document_icon.gif'
        migrateTypeIcons(self.portal)
        self.assertEqual(tt.Document.icon_expr,
                         "string:${portal_url}/document_icon.png")