Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py	(revision 6481)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py	(revision 6482)
@@ -30,4 +30,5 @@
 from zope.app.testing.functional import HTTPCaller as http
 from zope.component import createObject
+from zope.component.hooks import setSite, clearSite
 from zope.security.interfaces import Unauthorized
 from zope.testbrowser.testing import Browser
@@ -36,5 +37,8 @@
 from waeup.sirp.applicants.container import ApplicantsContainer
 from waeup.sirp.applicants.applicants import Applicant
-
+from waeup.sirp.university.faculty import Faculty
+from waeup.sirp.university.department import Department
+from waeup.sirp.university.certificate import Certificate
+from waeup.sirp.university.certificatecontainer import CertificateContainer
 
 class ApplicantsUITests(FunctionalTestCase):
@@ -60,7 +64,20 @@
         app['applicants']['app2009'] = applicantscontainer
 
+        # Populate university
+        faculty = Faculty()
+        department = Department()
+        cert_container = CertificateContainer()
+        certificate = Certificate(code='CERT1')
+        certificate.application_category = 'basic'
+        app['faculties']['fac1'] = faculty
+        app['faculties']['fac1']['dep1'] = department
+        app['faculties']['fac1']['dep1'].certificates = cert_container
+        app['faculties']['fac1']['dep1'].certificates['CERT1'] = certificate
+
         # Put the prepopulated site into test ZODB and prepare test
         # browser
         self.getRootFolder()['app'] = app
+        self.app = self.getRootFolder()['app']
+        setSite(self.app)
         self.browser = Browser()
         self.browser.handleErrors = False
@@ -78,11 +95,12 @@
 
         # Add an applicant
-        applicant = Applicant()
+        self.applicant = Applicant()
         self.pin_applicant = unicode(self.pins[1])
-        applicant.access_code = self.pin_applicant
-        app['applicants']['app2009'][self.pin_applicant] = applicant
+        self.applicant.access_code = self.pin_applicant
+        app['applicants']['app2009'][self.pin_applicant] = self.applicant
 
     def tearDown(self):
         super(ApplicantsUITests, self).tearDown()
+        clearSite()
         shutil.rmtree(self.dc_root)
 
@@ -98,4 +116,11 @@
             'Manage' in self.browser.contents)
         return
+
+    def test_manage_cert_access(self):
+        # Managers can access CERT1
+        cert_path = 'http://localhost/app/faculties/fac1/dep1/certificates/CERT1'
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(cert_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
 
     def test_manage_access(self):
@@ -130,5 +155,6 @@
         self.browser.getControl(name="form.prefix").value = ['app']
         self.browser.getControl(name="form.year").value = ['2010']
-        self.browser.getControl(name="form.provider").value = ['waeup.sirp.applicants.ApplicantsContainer']
+        self.browser.getControl(name="form.provider").value = [
+            'waeup.sirp.applicants.ApplicantsContainer']
         self.browser.getControl(name="form.ac_prefix").value = ['APP']
         self.browser.getControl(name="form.application_category").value = ['basic']
@@ -175,5 +201,10 @@
         self.browser.open(self.applicant_manage_path)
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
-        self.browser.getControl(name="form.firstname").value = 'Jonathan'
+        self.browser.getControl(name="form.firstname").value = 'John'
+        self.browser.getControl(name="form.lastname").value = 'Tester'
+        self.browser.getControl(name="form.course1").value = ['CERT1']
+        self.browser.getControl(name="form.date_of_birth").value = 'Jonathan'
+        self.browser.getControl(name="form.lga").value = ['foreigner']
+        self.browser.getControl(name="form.sex").value = ['male']
         self.browser.getControl("Save").click()
         self.assertTrue('Required input is missing' in self.browser.contents)
