Ejemplo n.º 1
0
class Test(base.UnitTestCase):

    def setUp(self):
        super(Test, self).setUp()
        from collective.gallery import folder
        self.view = folder.BaseFolderView(self.context, self.request)
        self.view.settings = utils.FakeProperty
        self.view._brainToPhoto = utils.brainToPhoto

    def testPhotos(self):

        # vipod (from irc channel): temporary fix to show IAnnotations problem:
        # default IAnnotations adapter wasn't registered so I'm registering it
        # here by manually including zope.annotation configuration,
        # actually imgs() method uses too many plone functions, so to override
        # all this behaviour you'll also need to patch getToolByName which is
        # used by this method, thus I think it'd be easier to implement this
        # testcase as integrational, inherited from PloneTestCase
        try:
            from Zope2.App import zcml
        except ImportError, e:
            from Products.Five import zcml
        import zope.component
        import zope.annotation
        zcml.load_config('meta.zcml', zope.component)
        zcml.load_config('configure.zcml', zope.annotation)


        imgs = self.view.photos()
        self.assertEqual(len(imgs), 2)

        for img in imgs:
            test, msg = utils.verifyImage(img)
            self.failUnless(test, msg)
Ejemplo n.º 2
0
    def testPhotos(self):

        # vipod (from irc channel): temporary fix to show IAnnotations problem:
        # default IAnnotations adapter wasn't registered so I'm registering it
        # here by manually including zope.annotation configuration,
        # actually imgs() method uses too many plone functions, so to override
        # all this behaviour you'll also need to patch getToolByName which is
        # used by this method, thus I think it'd be easier to implement this
        # testcase as integrational, inherited from PloneTestCase
        try:
            from Zope2.App.zcml import load_config
        except ImportError:
            from Products.Five.zcml import load_config
        import zope.component
        import zope.annotation

        load_config('meta.zcml', zope.component)
        load_config('configure.zcml', zope.annotation)

        imgs = self.view.photos()
        self.assertEqual(len(imgs), 2)

        for img in imgs:
            test, msg = utils.verifyImage(img)
            self.assertTrue(test, msg)
Ejemplo n.º 3
0
    def testPhotos(self):

        # vipod (from irc channel): temporary fix to show IAnnotations problem:
        # default IAnnotations adapter wasn't registered so I'm registering it
        # here by manually including zope.annotation configuration,
        # actually imgs() method uses too many plone functions, so to override
        # all this behaviour you'll also need to patch getToolByName which is
        # used by this method, thus I think it'd be easier to implement this
        # testcase as integrational, inherited from PloneTestCase
        try:
            from Zope2.App.zcml import load_config
        except ImportError:
            from Products.Five.zcml import load_config
        import zope.component
        import zope.annotation

        load_config('meta.zcml', zope.component)
        load_config('configure.zcml', zope.annotation)

        imgs = self.view.photos()
        self.assertEqual(len(imgs), 2)

        for img in imgs:
            test, msg = utils.verifyImage(img)
            self.assertTrue(test, msg)
Ejemplo n.º 4
0
 def testPhotos(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.assertTrue(test, msg)
     self.assertEqual(len(imgs), 50, len(imgs))
Ejemplo n.º 5
0
 def testPhotos(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.failUnless(test, msg)
     self.failUnless(len(imgs)==50, len(imgs))
Ejemplo n.º 6
0
 def testPhotosAuth(self):
     adapter = self.getAdapter(AUTH_URL)
     imgs = adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.assertTrue(test, msg)
Ejemplo n.º 7
0
 def testPhotosNonAuth(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.assertTrue(test, msg)
Ejemplo n.º 8
0
 def testPhotos(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.assertTrue(test, msg)
     self.assertEqual(len(imgs), 50, len(imgs))
Ejemplo n.º 9
0
 def testPhotosNonAuth(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.failUnless(test, msg)
Ejemplo n.º 10
0
 def testPhotos(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.failUnless(test, msg)
Ejemplo n.º 11
0
 def testPhotosAuth(self):
     adapter = self.getAdapter(AUTH_URL)
     imgs = adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.assertTrue(test, msg)
Ejemplo n.º 12
0
 def testPhotosNonAuth(self):
     imgs = self.adapter.photos()
     for img in imgs:
         test, msg = utils.verifyImage(img)
         self.assertTrue(test, msg)