Hi Benji > -----Original Message----- > From: Benji York [mailto:[EMAIL PROTECTED] > Sent: Saturday, December 03, 2005 4:56 PM > To: Roger Ineichen > Cc: zope3-dev@zope.org > Subject: Re: [Zope3-checkins] SVN: Zope3/trunk/ Bugfix: > > Roger Ineichen wrote: > > Log message for revision 40515: > > Bugfix: > > Using getLink('File') will end in a testing failure in > our application > > because we use a content type '- File' which produce a > link called '- File'. > > Use the more concrete url attribute instead of the text > attribute in > > the getLink method will avoid this. > > > > See also collector issue at: > > http://www.zope.org/Collectors/Zope3-dev/503 > > > Modified: > Zope3/trunk/src/zope/app/apidoc/codemodule/browser/introspector.txt > > =================================================================== > > --- > Zope3/trunk/src/zope/app/apidoc/codemodule/browser/introspec > tor.txt 2005-12-03 04:34:49 UTC (rev 40514) > > +++ > Zope3/trunk/src/zope/app/apidoc/codemodule/browser/introspec > tor.txt 2005-12-03 12:32:48 UTC (rev 40515) > > @@ -134,7 +134,8 @@ > > they are provided in a aseparate section. To see anything > useful, we have to > > add an object to the folder first: > > > > - >>> browser.getLink('File').click() > > + >>> link = > 'http://localhost/@@+/action.html?type_name=zope.app.file.File' > > + >>> browser.getLink(url=link).click() > > >>> import cStringIO > > >>> browser.getControl('Data').value = > cStringIO.StringIO('content') > > >>> browser.getControl(name='add_input_name').value = > 'file.txt' > > This isn't really in the "spirit" of testbrowser. Previously > the test > would ensure that the desired link appeared on the page, was named > correctly (if a bit too generically), and that it went to the > appropriate place. The new version just makes sure the > hard-coded URL > points to the correct page.
The previous test isn't usefull and raises errors. It's probably usefull as a human readable documentation. If I have a link give from a custom content type called 'My File' and the original link isn't there because of a missconfguration, the test whould also pass. Which I guess ins't the target. I think we have to find a way where we can ensure that we test the correct part and only that part. Perhaps this is only a usecase if we test generic registrablecomponent where will produce links. Perhaps a method testLink('File') whould be Ok for testing. But the combination of getLink('File').click() isn't a good idea. Then this will end in messing up the test if I register a content type called 'A File' where is rendered before the 'File' link in HTML. > I prefer some variation on the previous style (with appropriate > correction so it isn't so brittle). > Comments/ideas? Not really ;-) Regards Roger Ineichen > -- > Benji York > Senior Software Engineer > Zope Corporation > _______________________________________________ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com