|
From: Albertas A. <al...@co...> - 2001-12-22 21:17:07
|
Hello,
As noone took the trouble to answer my questions, after I've figured
the things out myself, I think this might turn out useful for someone.
On Tue, Dec 18, 2001 at 12:41:14PM +0200, Albertas Agejevas wrote:
> * How to call a DTML method from a Tests.TestCase descendant?
> My take would be something like
>
> self.ZopeContext.re.Property.detailsHtml(self.zopeNames['_'].None,
> self.zopeNames['_'])
That would be
cx = self.ZopeContext
Property = cx.re.Property
REQUEST = cx.REQUEST
Property.detailsHtml(Property, REQUEST)
> * And, yes, any hints on if it's possible to switch the authenticated
> user, so we could test our permissions management?
from AccessControl.User import SimpleUser
oldUser = REQUEST['AUTHENTICATED_USER']
REQUEST['AUTHENTICATED_USER'] = SimpleUser('user', 'passwd',
('Role1', 'Role2'),())
Hope it'll be useful for anybody.
Cheers, and Merry X-mas!
Albertas
|