def testMultiApplyAndUnapply(self):
        # Test that multiple patching and unpatching works.
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ('Manager',))
        catalog = getToolByName(portal, 'portal_catalog')
        base_count = len(catalog.searchResults({}))

        # One
        apply_patches(portal)
        doc = self._makeOne()
        self.assertEqual(len(catalog.searchResults({})), base_count)
        unapply_patches(portal)
        self.assertEqual(len(catalog.searchResults({})), base_count)
        doc.reindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count + 1)
        doc.unindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count)

        # Two
        apply_patches(portal)
        doc = self._makeOne()
        self.assertEqual(len(catalog.searchResults({})), base_count)
        unapply_patches(portal)
        self.assertEqual(len(catalog.searchResults({})), base_count)
        doc.reindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count + 1)
        doc.unindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count)
Esempio n. 2
0
    def testMultiApplyAndUnapply(self):
        # Test that multiple patching and unpatching works.
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ('Manager', ))
        catalog = getToolByName(portal, 'portal_catalog')
        base_count = len(catalog.searchResults({}))

        # One
        apply_patches(portal)
        doc = self._makeOne()
        self.assertEqual(len(catalog.searchResults({})), base_count)
        unapply_patches(portal)
        self.assertEqual(len(catalog.searchResults({})), base_count)
        doc.reindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count + 1)
        doc.unindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count)

        # Two
        apply_patches(portal)
        doc = self._makeOne()
        self.assertEqual(len(catalog.searchResults({})), base_count)
        unapply_patches(portal)
        self.assertEqual(len(catalog.searchResults({})), base_count)
        doc.reindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count + 1)
        doc.unindexObject()
        self.assertEqual(len(catalog.searchResults({})), base_count)
 def testUnapply(self):
     portal = self.layer['portal']
     setRoles(portal, TEST_USER_ID, ('Manager',))
     catalog = getToolByName(portal, 'portal_catalog')
     base_count = len(catalog.searchResults({}))
     doc = self._makeOne()
     self.assertEqual(len(catalog.searchResults({})), base_count)
     unapply_patches(portal)
     self.assertEqual(len(catalog.searchResults({})), base_count)
     doc.reindexObject()
     self.assertEqual(len(catalog.searchResults({})), base_count + 1)
Esempio n. 4
0
 def testUnapply(self):
     portal = self.layer['portal']
     setRoles(portal, TEST_USER_ID, ('Manager', ))
     catalog = getToolByName(portal, 'portal_catalog')
     base_count = len(catalog.searchResults({}))
     doc = self._makeOne()
     self.assertEqual(len(catalog.searchResults({})), base_count)
     unapply_patches(portal)
     self.assertEqual(len(catalog.searchResults({})), base_count)
     doc.reindexObject()
     self.assertEqual(len(catalog.searchResults({})), base_count + 1)