[Zope3-Users] Doctests and authenticated principal
maciej.wisniowski at coig.katowice.pl
Wed Jan 31 05:28:12 EST 2007
I'm writing doctest using DocFileSuite.
Code that I'm testing needs information
about currently authenticated principal.
It uses: request.principal.id to get it.
In doc test I may use:
>>> request = TestRequest()
>>> class User(object):
... id = 'Jan'
... title = 'Jan Kowalski'
..........rest of the test......
and after this everything works.
Is this correct way?
I also have some code that uses:
from zope.app.security.interfaces import ILoginPassword
During tests, I always get None as result of the above
So another question, what is the correct way to
get currently authenticated principal id:
request.principal.id or ILoginPassword(self.request).getLogin()?
More information about the Zope3-users