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)
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)
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))
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))
def testPhotosAuth(self): adapter = self.getAdapter(AUTH_URL) imgs = adapter.photos() for img in imgs: test, msg = utils.verifyImage(img) self.assertTrue(test, msg)
def testPhotosNonAuth(self): imgs = self.adapter.photos() for img in imgs: test, msg = utils.verifyImage(img) self.assertTrue(test, msg)
def testPhotosNonAuth(self): imgs = self.adapter.photos() for img in imgs: test, msg = utils.verifyImage(img) self.failUnless(test, msg)
def testPhotos(self): imgs = self.adapter.photos() for img in imgs: test, msg = utils.verifyImage(img) self.failUnless(test, msg)