[Zope-CMF] Testing skin scripts and templates using ZopeTestCase.Functional

Tom Dossis td at yoma.com.au
Wed Oct 5 19:02:45 EDT 2005


Paul Winkler wrote:
> Hi again :)
> I'm trying to use CMFTestCase along with ZopeTestCase.Functional
> to test my skin scripts.  But how do I get them set up
> properly? Anybody have working examples of this?  I wondered
> if there might be some in the Plone test suites but if so I
> didn't find any.
> 
> Example that fails because "document_view" is 404:
> 
> class TestUI(CMFTestCase.CMFTestCase,
>              ZopeTestCase.FunctionalTestCase,
>              ):
> 
>     """Test the skin scripts and templates.
>     """
> 
>     def getPortal(self):
>         # Set up a CMF site.
>         setupCMFSite(app=self.app)
>         return getattr(self.app, CMFTestCase.portal_name)
> 
>     def afterSetUp(self):
>         self.basic_auth = '%s:%s' % (user_name, user_password)
>         self.setRoles(['Manager', 'Member'])
>         # Add a folder and a doc.
>         self.portal.invokeFactory(type_name='Folder', id='folder1')
>         self.fol1 = self.portal.folder1
>         data = 'Testing ZSyncer Tool, blah blah blah'
>         self.fol1.invokeFactory('Document', 'test_doc1',
>                                 title='nunya bizness',
>                                 text=data)
>         self.doc1 = self.fol1.test_doc1
> 
>     def test_DocView(self):
>         url = self.doc1.absolute_url_path()
>         import pdb; pdb.set_trace()
>         response = self.publish(url, self.basic_auth)
> 
> 
> Some stepping around with pdb reveals this:
> ....
> (Pdb) n
>>/zope/ZopeSoftwareHome/lib/python/ZPublisher/Publish.py(101)publish()
> -> request, bind=1)
> (Pdb) n
> NotFound: 'document_view'
> 

Maybe adding the following in afterSetUp() will help.

         self._refreshSkinData()


-Tom


More information about the Zope-CMF mailing list