Changeset 7043 for main/waeup.sirp/branches/ulif-extimgstore/src/waeup
- Timestamp:
- 8 Nov 2011, 21:57:33 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/branches/ulif-extimgstore/src/waeup/sirp/applicants/tests/test_authentication.py
r6730 r7043 24 24 import unittest 25 25 from zope.authentication.interfaces import IAuthentication 26 from zope.component import provideAdapter, getUtility 26 from zope.component import provideAdapter, getUtility, queryUtility 27 27 from zope.component.hooks import setSite 28 28 from zope.interface import verify … … 35 35 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase 36 36 from waeup.sirp.app import University 37 from waeup.sirp.interfaces import IAuthPluginUtility 37 38 from waeup.sirp.applicants import ApplicantsContainer, Applicant 38 39 from waeup.sirp.applicants.authentication import ( 39 40 ApplicantsAuthenticatorPlugin, WAeUPApplicantCredentialsPlugin, 40 41 ApplicantCredentials, AuthenticatedApplicantPrincipalFactory, 41 ApplicantPrincipalInfo, ApplicantPrincipal, )42 ApplicantPrincipalInfo, ApplicantPrincipal, ApplicantsAuthUtility) 42 43 43 44 … … 367 368 return 368 369 369 def test_suite(): 370 suite = unittest.TestSuite() 371 for testcase in [ 372 AuthenticatorPluginTest, CredentialsPluginTest, 373 ApplicantCredentialsTest, PrincipalFactoryTest, 374 PAUSetupTest, 375 ]: 376 suite.addTest(unittest.TestLoader().loadTestsFromTestCase( 377 testcase 378 ) 379 ) 380 return suite 370 class FakePAU(object): 371 credentialsPlugins = () 372 authenticatorPlugins = () 373 374 class ApplicantsAuthUtilityTests(FunctionalTestCase): 375 376 layer = FunctionalLayer 377 378 def test_ifaces(self): 379 # make sure we fullfill the interface promises 380 obj = ApplicantsAuthUtility() 381 verify.verifyClass(IAuthPluginUtility, ApplicantsAuthUtility) 382 verify.verifyObject(IAuthPluginUtility, obj) 383 return 384 385 def test_utility_available(self): 386 # we can get an applicant auth utility by lookup 387 util = queryUtility(IAuthPluginUtility, 388 name='applicants_auth_setup') 389 self.assertTrue(util is not None) 390 return 391 392 def test_register(self): 393 # make sure we can register additional components 394 pau = FakePAU() 395 result = ApplicantsAuthUtility().register(pau) 396 self.assertEqual( 397 result.credentialsPlugins, ('applicant_credentials',)) 398 self.assertEqual( 399 result.authenticatorPlugins, ('applicants',)) 400 return 401 402 def test_unregister(self): 403 # make sure we can unregister applicant auth components 404 pau = FakePAU() 405 util = ApplicantsAuthUtility() 406 pau = util.register(pau) 407 result = util.unregister(pau) 408 self.assertEqual( 409 result.credentialsPlugins, ()) 410 self.assertEqual( 411 result.authenticatorPlugins, ()) 412 return
Note: See TracChangeset for help on using the changeset viewer.