Index: main/waeup.imostate/src/waeup/imostate/applicants/tests/test_browser.py
===================================================================
--- main/waeup.imostate/src/waeup/imostate/applicants/tests/test_browser.py	(revision 10364)
+++ main/waeup.imostate/src/waeup/imostate/applicants/tests/test_browser.py	(revision 10366)
@@ -75,8 +75,8 @@
         # Create a pseudo file and select it to be uploaded in form
         pdf_content = 'A' * 1024 * 600  # A string of 600 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.extraform')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.extraform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
         self.browser.getControl("Save").click() # submit form
         # We get a warning message
@@ -85,8 +85,8 @@
         # Create a pseudo file with acceptable size
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.extraform')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.extraform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
         self.browser.getControl("Save").click() # submit form
         # Even though the form could not be saved ...
@@ -119,8 +119,8 @@
         # Create a pseudo file with acceptable size
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.extraform')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.extraform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
         self.browser.getControl("Save").click() # submit form
         # Even though the form could not be saved ...
@@ -166,8 +166,8 @@
         # Create a pseudo file and select it to be uploaded in form
         pdf_content = 'A' * 1024 * 600  # A string of 600 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.refereeform')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.refereeform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
         self.browser.getControl("Save").click() # submit form
         # We get a warning message
@@ -176,8 +176,8 @@
         # Create a pseudo file with acceptable size
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.refereeform')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.refereeform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
         self.browser.getControl("Save").click() # submit form
         # Even though the form could not be saved ...
@@ -210,8 +210,8 @@
         # Create a pseudo file with acceptable size
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.refereeform')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.refereeform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
         self.browser.getControl("Save").click() # submit form
         # Even though the form could not be saved ...
@@ -252,78 +252,32 @@
         self.assertTrue(fd is None)
 
-    def test_upload_credentials_by_manager(self):
-        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        self.browser.open(self.manage_path)
-        # Create a pseudo file with acceptable size
-        pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
-        pseudo_pdf = StringIO(pdf_content)
-        # This is a ug applicant, thus the credentials is not
-        # required
-        self.assertFalse('credentials">' in self.browser.contents)
-
-        # We have to add a pg applicants container
-        container_name = u'pg%s' % (datetime.now().year - 1)
-        applicantscontainer = ApplicantsContainer()
-        applicantscontainer.code = container_name
-        applicantscontainer.prefix = 'pgft'
-        applicantscontainer.year = datetime.now().year - 1
-        applicantscontainer.title = u'This is the %s container' % container_name
-        applicantscontainer.application_category = 'pg_ft'
-        applicantscontainer.mode = 'create'
-        applicantscontainer.strict_deadline = True
-        delta = timedelta(days=10)
-        applicantscontainer.startdate = datetime.now(pytz.utc) - delta
-        applicantscontainer.enddate = datetime.now(pytz.utc) + delta
-        self.app['applicants'][container_name] = applicantscontainer
-        applicant = createObject('waeup.Applicant')
-        # reg_number is the only field which has to be preset here
-        # because managers are allowed to edit this required field
-        applicant.reg_number = u'2345'
-        applicant.course1 = self.certificate
-        self.app['applicants'][container_name].addApplicant(applicant)
-        self.manage_path_pg = 'http://localhost/app/applicants/%s/%s/%s' % (
-            container_name, applicant.application_number, 'manage')
-        self.view_path_pg = 'http://localhost/app/applicants/%s/%s' % (
-            container_name, applicant.application_number)
-
-        self.browser.open(self.manage_path_pg)
-        ctrl = self.browser.getControl(name='form.credentials')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
-        self.browser.getControl("Save").click() # submit form
-        # Even though the form could not be saved ...
-        self.assertTrue('Required input is missing' in self.browser.contents)
-        # ... the file has been successfully uploaded
-        pdf_url = self.manage_path_pg.replace('manage', 'credentials.pdf')
-        self.browser.open(pdf_url)
-        self.assertEqual(
-            self.browser.headers['content-type'], 'application/pdf')
-        self.assertEqual(len(self.browser.contents), 307200)
-        # There is rally a file stored for the applicant
-        storage = getUtility(IExtFileStore)
-        file_id = IFileStoreNameChooser(applicant).chooseName(
-            attr='credentials.pdf')
-        # The stored file can be fetched
-        fd = storage.getFile(file_id)
-        file_len = len(fd.read())
-        self.assertEqual(file_len, 307200)
-        # A file link is displayed on the edit view ...
-        self.browser.open(self.manage_path_pg)
-        self.assertTrue('<a href="credentials.pdf">' in self.browser.contents)
-        # ... and on the dislay view
-        self.browser.open(self.view_path_pg)
-        self.assertTrue('<a href="credentials.pdf">Credentials</a>'
-            in self.browser.contents)
-        # Adding file is properly logged
-        logfile = os.path.join(
-            self.app['datacenter'].storage, 'logs', 'applicants.log')
-        logcontent = open(logfile).read()
-        self.assertTrue(
-            'zope.mgr - waeup.imostate.applicants.browser.CustomApplicantManageFormPage'
-            ' - %s - saved: credentials'
-            % (applicant.applicant_id)
-            in logcontent)
-        # When an applicant is removed, also the pdf files are gone.
-        del self.app['applicants'][container_name][applicant.application_number]
-        fd = storage.getFile(file_id)
-        self.assertTrue(fd is None)
+    def test_applicant_workflow(self):
+        # Applicants can edit their record
+        self.browser.open(self.login_path)
+        self.login()
+        self.assertTrue(
+            'You logged in.' in self.browser.contents)
+        self.browser.open(self.edit_path)
+        self.assertTrue(self.browser.url != self.login_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.fill_correct_values()
+        self.browser.getControl(name="form.nationality").value = ['NG']
+        self.browser.getControl("Save").click()
+        self.assertTrue('Form has been saved' in self.browser.contents)
+        self.assertTrue('started ' in self.browser.contents)
+
+        pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
+        pseudo_file = StringIO(pdf_content)
+        ctrl = self.browser.getControl(name='form.passport')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myphoto.jpg')
+        ctrl = self.browser.getControl(name='form.extraform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
+        ctrl = self.browser.getControl(name='form.refereeform')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
+
+        self.browser.getControl(name="confirm_passport").value = True
+        self.browser.getControl("Save").click()
+        return
Index: main/waeup.imostate/src/waeup/imostate/applicants/utils.py
===================================================================
--- main/waeup.imostate/src/waeup/imostate/applicants/utils.py	(revision 10364)
+++ main/waeup.imostate/src/waeup/imostate/applicants/utils.py	(revision 10366)
@@ -37,3 +37,4 @@
     APP_TYPES_DICT = {
         'ymwp': ['Youths Must Work Programme', 'YMWP'],
+        'app': ['General Studies', 'APP'],
         }
