Hi

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'
>>> request.setPrincipal(User())
..........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
ILoginPassword(self.request).getLogin()

During tests, I always get None as result of the above
statement.

So another question, what is the correct way to
get currently authenticated principal id:
request.principal.id or ILoginPassword(self.request).getLogin()?

-- 
Maciej Wisniowski



_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to