Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_authentication.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_authentication.py	(revision 5896)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_authentication.py	(revision 5897)
@@ -21,6 +21,10 @@
 ##
 import grok
+import shutil
+import tempfile
 import unittest
-from zope.component import provideAdapter
+from zope.app.testing.functional import FunctionalTestCase
+from zope.authentication.interfaces import IAuthentication
+from zope.component import provideAdapter, getUtility
 from zope.component.hooks import setSite, clearSite
 from zope.interface import verify
@@ -30,9 +34,13 @@
 from zope.session.interfaces import ISession
 from zope.site import LocalSiteManager
+from zope.testbrowser.testing import Browser
 from zope.testing import cleanup
+from waeup.sirp.testing import FunctionalLayer
+from waeup.sirp.app import University
 from waeup.sirp.applicants.authentication import (
     ApplicantsAuthenticatorPlugin, WAeUPApplicantCredentialsPlugin,
     ApplicantCredentials, AuthenticatedApplicantPrincipalFactory,
     ApplicantPrincipalInfo, ApplicantPrincipal)
+
 
 class FakeBatch(dict):
@@ -289,5 +297,51 @@
         self.assertEqual(principal.id, 'APP-1-1234567890')
         return
+
+class PAUSetupTest(FunctionalTestCase):
+    # Check correct setup of authentication components in the
+    # applicants subpackage.
+
+    # When a university is created, we want by default have our local
+    # authentication components (an authenticator plugin and a
+    # credentials plugin) to be registered with the local PAU. Admins
+    # can remove these components on the fly later-on if they wish.
+    
+    layer = FunctionalLayer
+    
+    def setUp(self):
+        super(PAUSetupTest, self).setUp()
+
+        # Setup a sample site for each test
+        app = University()
+        self.dc_root = tempfile.mkdtemp()
+        app['datacenter'].setStoragePath(self.dc_root)
+
+        # Prepopulate the ZODB...
+        self.getRootFolder()['app'] = app
+        self.app = self.getRootFolder()['app']
+        self.browser = Browser()
+        self.browser.handleErrors = False
+
+    def tearDown(self):
+        super(PAUSetupTest, self).tearDown()
+        shutil.rmtree(self.dc_root)
+
+    def test_extra_auth_plugins_installed(self):
+        # Check whether the auth plugins defined in here are setup
+        # automatically when a university is created
+
+        # Get the PAU responsible for the local site ('app')
+        pau = getUtility(IAuthentication, context=self.app)
+        cred_plugins = pau.getCredentialsPlugins()
+        auth_plugins = pau.getAuthenticatorPlugins()
+        cred_names = [name for name, plugin in cred_plugins]
+        auth_names = [name for name, plugin in auth_plugins]
         
+        # Make sure our local ApplicantsAuthenticatorPlugin is registered...
+        self.assertTrue('applicants' in auth_names)
+        # Make sure our local WAeUPApplicantCredentialsPlugin is registered...
+        self.assertTrue('applicant_credentials' in cred_names)
+        return
+
 def test_suite():
     suite = unittest.TestSuite()
@@ -295,4 +349,5 @@
         AuthenticatorPluginTest, CredentialsPluginTest,
         ApplicantCredentialsTest, PrincipalFactoryTest,
+        PAUSetupTest,
         ]:
         suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
