Beispiel #1
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     enable_social_media_behavior()
     self.setup_content()
     api.portal.set_registry_record(
         name='canonical_domain', value='https://example.org', interface=ISocialLikeSettings)
Beispiel #2
0
    def setUp(self):
        self.portal = self.layer['portal']
        registry = getUtility(IRegistry)
        self.settings = registry.forInterface(ISocialLikeSettings)
        enable_social_media_behavior()

        with api.env.adopt_roles(['Manager']):
            self.obj = api.content.create(self.portal, 'News Item', 'foo')
    def setUp(self):
        self.portal = self.layer['portal']
        registry = getUtility(IRegistry)
        self.settings = registry.forInterface(ISocialLikeSettings)
        self.settings.canonical_domain = 'http://example.org'
        enable_social_media_behavior()

        with api.env.adopt_roles(['Manager']):
            self.obj = api.content.create(self.portal, 'News Item', 'foo')
Beispiel #4
0
    def test_reindex_catalog(self):
        # check if the upgrade step is registered
        title = 'Reindex catalog'
        step = self.get_upgrade_step(title)
        self.assertIsNotNone(step)

        from sc.social.like.behaviors import ISocialMedia
        from sc.social.like.tests.utils import enable_social_media_behavior
        with api.env.adopt_roles(['Manager']):
            for i in range(0, 10):
                api.content.create(self.portal, 'News Item', str(i))

        # break the catalog by deleting an object without notifying
        self.portal._delObject('0', suppress_events=True)
        self.assertNotIn('0', self.portal)
        enable_social_media_behavior()
        results = api.content.find(object_provides=ISocialMedia.__identifier__)
        self.assertEqual(len(results), 0)

        # run the upgrade step to validate it
        self.request.set('test', True)  # avoid transaction commits on tests
        self.execute_upgrade_step(step)
        results = api.content.find(object_provides=ISocialMedia.__identifier__)
        self.assertEqual(len(results), 9)  # no failure and catalog updated
    def test_reindex_catalog(self):
        # check if the upgrade step is registered
        title = u'Reindex catalog'
        step = self.get_upgrade_step(title)
        self.assertIsNotNone(step)

        from sc.social.like.behaviors import ISocialMedia
        from sc.social.like.tests.utils import enable_social_media_behavior
        with api.env.adopt_roles(['Manager']):
            for i in range(0, 10):
                api.content.create(self.portal, 'News Item', str(i))

        # break the catalog by deleting an object without notifying
        self.portal._delObject('0', suppress_events=True)
        self.assertNotIn('0', self.portal)
        enable_social_media_behavior()
        results = api.content.find(object_provides=ISocialMedia.__identifier__)
        self.assertEqual(len(results), 0)

        # run the upgrade step to validate it
        self.request.set('test', True)  # avoid transaction commits on tests
        self.execute_upgrade_step(step)
        results = api.content.find(object_provides=ISocialMedia.__identifier__)
        self.assertEqual(len(results), 9)  # no failure and catalog updated