Ignore:
Timestamp:
3 Sep 2011, 23:38:21 (13 years ago)
Author:
uli
Message:

Factor out get_principal_role_manager from w.s.authentication.Account.
This method had nothing specific for class and we have use for it in
students authentication.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/tests/test_authentication.py

    r6617 r6673  
    44from zope.interface.verify import verifyClass, verifyObject
    55from zope.pluggableauth.interfaces import IAuthenticatorPlugin
     6from zope.securitypolicy.interfaces import IPrincipalRoleManager
    67from waeup.sirp.testing import FunctionalTestCase, FunctionalLayer
    78from waeup.sirp.authentication import (
    8     UserAuthenticatorPlugin, Account, PrincipalInfo)
     9    UserAuthenticatorPlugin, Account, PrincipalInfo, get_principal_role_manager)
    910
    1011class FakeSite(grok.Site, grok.Container):
     
    5758        self.assertTrue(result2 is None)
    5859        return
     60
     61    def test_get_principal_role_manager(self):
     62        # make sure we get different role managers for different situations
     63        prm1 = get_principal_role_manager()
     64        clearSite(None)
     65        prm2 = get_principal_role_manager()
     66        self.assertTrue(IPrincipalRoleManager.providedBy(prm1))
     67        self.assertTrue(IPrincipalRoleManager.providedBy(prm2))
     68        self.assertTrue(prm1._context is self.site)
     69        self.assertTrue(hasattr(prm2, '_context') is False)
     70        return
Note: See TracChangeset for help on using the changeset viewer.