Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py	(revision 13162)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py	(revision 13163)
@@ -68,4 +68,13 @@
     )
 
+# Define a validation method for jamb subjects
+class NotExactNumberOfItems(schema.ValidationError):
+    __doc__ = u"Not exactly 4 items selected."
+
+def four_items(value):
+    if len(value) != 4:
+        raise NotExactNumberOfItems(value)
+    return True
+
 class JAMBSubjectSource(SubjectSource):
     """A source for school subjects used in exam documentation.
@@ -233,6 +242,6 @@
     jamb_subjects_list = schema.List(
         title = _(u'JAMB Subjects'),
-        default = ['english_language',],
-        required = False,
+        required = False,
+        default = [],
         value_type = schema.Choice(
             vocabulary = jambsubjects
@@ -578,6 +587,6 @@
         title = _(u'JAMB Subjects'),
         description = _(u'Select four subjects.'),
-        default = ['english_language',],
-        required = True,
+        required = True,
+        constraint = four_items,
         value_type = schema.Choice(
             vocabulary = jambsubjects
Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_browser.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_browser.py	(revision 13162)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_browser.py	(revision 13163)
@@ -38,5 +38,5 @@
 from waeup.kofa.applicants.container import ApplicantsContainer
 from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup
-from waeup.kofa.interfaces import IBatchProcessor
+from waeup.kofa.interfaces import IBatchProcessor, IUserAccount
 from kofacustom.nigeria.testing import FunctionalLayer
 from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter
@@ -46,4 +46,5 @@
 app_container_name = u'app%s' % session_1
 pgft_container_name = u'pgft%s' % session_1
+cbt_container_name = u'cbt%s' % session_1
 
 class ApplicantUITest(FunctionalTestCase):
@@ -69,5 +70,5 @@
         setSite(app)
 
-        # Add an two different applicants containers
+        # Add three different applicants containers
         self.pgcontainer = ApplicantsContainer()
         self.pgcontainer.code = pgft_container_name
@@ -78,4 +79,5 @@
         self.pgcontainer.title = u'This is the %s container' % pgft_container_name
         self.app['applicants'][pgft_container_name] = self.pgcontainer
+
         self.ugcontainer = ApplicantsContainer()
         self.ugcontainer.code = app_container_name
@@ -86,9 +88,21 @@
         self.ugcontainer.title = u'This is the %s container' % app_container_name
         self.app['applicants'][app_container_name] = self.ugcontainer
-
         self.ugcontainer.mode = 'update'
         delta = datetime.timedelta(days=10)
         self.ugcontainer.startdate = datetime.datetime.now(pytz.utc) - delta
         self.ugcontainer.enddate = datetime.datetime.now(pytz.utc) + delta
+
+        self.cbtcontainer = ApplicantsContainer()
+        self.cbtcontainer.code = cbt_container_name
+        self.cbtcontainer.prefix = u'cbt'
+        self.cbtcontainer.application_category = u'basic'
+        self.cbtcontainer.year = session_1
+        self.cbtcontainer.application_fee = 300.0
+        self.cbtcontainer.title = u'This is the %s container' % cbt_container_name
+        self.app['applicants'][cbt_container_name] = self.cbtcontainer
+        self.cbtcontainer.mode = 'update'
+        delta = datetime.timedelta(days=10)
+        self.cbtcontainer.startdate = datetime.datetime.now(pytz.utc) - delta
+        self.cbtcontainer.enddate = datetime.datetime.now(pytz.utc) + delta
 
         # Populate university
@@ -128,8 +142,22 @@
         self.ugapplicant = self.app['applicants'][app_container_name][
             self.ugapplication_number]
+
+        cbtapplicant = createObject(u'waeup.Applicant')
+        cbtapplicant.firstname = u'Anna'
+        cbtapplicant.lastname = u'Cbt'
+        self.app['applicants'][cbt_container_name].addApplicant(cbtapplicant)
+        self.cbtapplication_number = cbtapplicant.application_number
+        self.cbtapplicant = self.app['applicants'][cbt_container_name][
+            self.cbtapplication_number]
+        IUserAccount(self.cbtapplicant).setPassword('apwd')
+
+        self.login_path = 'http://localhost/app/login'
+        self.logout_path = 'http://localhost/app/logout'
         self.pgapplicant_path = ('http://localhost/app/applicants/%s/%s'
             % (pgft_container_name, self.pgapplication_number))
         self.ugapplicant_path = ('http://localhost/app/applicants/%s/%s'
             % (app_container_name, self.ugapplication_number))
+        self.cbtapplicant_path = ('http://localhost/app/applicants/%s/%s'
+            % (cbt_container_name, self.cbtapplication_number))
 
         self.browser = Browser()
@@ -319,4 +347,45 @@
         self.assertEqual(student.nationality, 'NG')
         return
+
+    def test_applicant_access(self):
+        # Applicants can edit their record
+        self.browser.open(self.login_path)
+        self.browser.getControl(
+            name="form.login").value = self.cbtapplicant.applicant_id
+        self.browser.getControl(name="form.password").value = 'apwd'
+        self.browser.getControl("Login").click()
+        self.assertTrue(
+            'You logged in.' in self.browser.contents)
+        self.browser.getLink("Edit application record").click()
+        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
+        self.browser.getControl(name="form.lga").value = ['foreigner']
+        self.browser.getControl(name="form.nationality").value = ['NG']
+        self.browser.getControl(name="form.sex").value = ['m']
+        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
+        self.browser.getControl(name="form.course1").value = ['CERT1']
+        self.browser.getControl("Save").click()
+        self.assertMatches('...Not exactly 4 items selected...', self.browser.contents)
+        # Since the testbrowser does not support Javascrip we can't test the
+        # save action which clears jamb_subjects_list on the edit form page
+        # An error would be raised.
+
+        # If we login as manager, we can use the manage form page.
+        self.browser.open(self.logout_path)
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.cbtapplicant.jamb_subjects_list = [
+          'english_language', 'fine_art', 'mathematics', 'physics']
+        self.browser.open(self.cbtapplicant_path + '/manage')
+        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
+        self.browser.getControl(name="form.lga").value = ['foreigner']
+        self.browser.getControl(name="form.nationality").value = ['NG']
+        self.browser.getControl(name="form.sex").value = ['m']
+        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
+        self.browser.getControl(name="form.course1").value = ['CERT1']
+        self.browser.getControl(name="form.reg_number").value = '1234'
+        self.browser.getControl("Save").click()
+        self.assertMatches('...Form has been saved...', self.browser.contents)
+        # The save action on this form pages, if called with the testbrowser,
+        # replaces jamb_subjects_list by an empty list (and not by None).
+        self.assertEqual(self.cbtapplicant.jamb_subjects_list, [])
 
 class ApplicantExporterTest(ApplicantImportExportSetup):
