Hi, I'm having a little trouble with writing the tests for my formlib folder contents view replacement. The basic tests (based on yuppie's doctests) are fine but incomplete. I'm now integrating batching and am getting caught on view permissions for DummyContent objects.
This is the test: def _make_batch(self): from Products.CMFCore.tests.base.dummy import DummyContent batch_size = 25 for i in range(batch_size + 2): content_id = "Dummy%s" % i content_obj = DummyContent(content_id) content_obj.portal_type = "Dummy Content" obj = self.folder._setObject(content_id, content_obj) content_obj.manage_setLocalRoles('user_foo', ['Owner']) def test_check_batching(self): self._make_batch() batch_size = 25 view = ContentsView(self.folder, TestRequest()) self.assertEquals(view._getBatchObj().sequence_length, batch_size) self.assertEquals(view.navigation_next['title'], "NEXT N ITEMS") and this is error: File "/Users/charlieclark/cmf-svn/CMF.buildout/trunk/src/Zope2/src/ AccessControl/ZopeGuards.py", line 71, in guarded_getitem if getSecurityManager().validate(object, object, None, v): Unauthorized: (item 0): You are not allowed to access 'Dummy0' in this context Obviously I don't have the permission to access my newly created objects. So how do I go about fixing this for my tests? I can't find a comparable example in the rest of the CMF tests? Is it best to fix the permissions of the objects so that are viewable be "anonymous" or should I assign my view to my user? And while I'm at it, am I creating my dummy objects in the right way? I remember Tres saying something about this recently. Charlie -- Charlie Clark Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 _______________________________________________ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests