Index: main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py	(revision 10096)
+++ main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py	(revision 10105)
@@ -65,5 +65,5 @@
         self.assertTrue(img is None)
 
-    def test_upload_formextension_by_student(self):
+    def test_upload_extraform_by_student(self):
         self.login()
         self.browser.open(self.edit_path)
@@ -71,5 +71,5 @@
         pdf_content = 'A' * 1024 * 600  # A string of 600 KB size
         pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.formextension')
+        ctrl = self.browser.getControl(name='form.extraform')
         file_ctrl = ctrl.mech_control
         file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
@@ -81,12 +81,12 @@
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
         pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.formextension')
-        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.edit_path.replace('edit', 'formextension.pdf')
+        ctrl = self.browser.getControl(name='form.extraform')
+        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.edit_path.replace('edit', 'extraform.pdf')
         self.browser.open(pdf_url)
         self.assertEqual(
@@ -96,18 +96,18 @@
         storage = getUtility(IExtFileStore)
         file_id = IFileStoreNameChooser(self.applicant).chooseName(
-            attr='formextension.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.edit_path)
-        self.assertTrue('<a href="formextension.pdf">' in self.browser.contents)
-        # ... and on the dislay view
-        self.browser.open(self.view_path)
-        self.assertTrue('<a href="formextension.pdf">Offline Form Extension</a>'
-            in self.browser.contents)
-
-    def test_upload_formextension_by_manager(self):
+            attr='extraform.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.edit_path)
+        self.assertTrue('<a href="extraform.pdf">' in self.browser.contents)
+        # ... and on the dislay view
+        self.browser.open(self.view_path)
+        self.assertTrue('<a href="extraform.pdf">Extra Applicant Information Form</a>'
+            in self.browser.contents)
+
+    def test_upload_extraform_by_manager(self):
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
         self.browser.open(self.manage_path)
@@ -115,12 +115,12 @@
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
         pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.formextension')
-        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.replace('manage', 'formextension.pdf')
+        ctrl = self.browser.getControl(name='form.extraform')
+        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.replace('manage', 'extraform.pdf')
         self.browser.open(pdf_url)
         self.assertEqual(
@@ -130,15 +130,15 @@
         storage = getUtility(IExtFileStore)
         file_id = IFileStoreNameChooser(self.applicant).chooseName(
-            attr='formextension.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)
-        self.assertTrue('<a href="formextension.pdf">' in self.browser.contents)
-        # ... and on the dislay view
-        self.browser.open(self.view_path)
-        self.assertTrue('<a href="formextension.pdf">Offline Form Extension</a>'
+            attr='extraform.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)
+        self.assertTrue('<a href="extraform.pdf">' in self.browser.contents)
+        # ... and on the dislay view
+        self.browser.open(self.view_path)
+        self.assertTrue('<a href="extraform.pdf">Extra Applicant Information Form</a>'
             in self.browser.contents)
         # Adding file is properly logged
@@ -148,5 +148,92 @@
         self.assertTrue(
             'zope.mgr - waeup.futminna.applicants.browser.CustomApplicantManageFormPage'
-            ' - %s - saved: formextension'
+            ' - %s - saved: extraform'
             % (self.applicant.applicant_id)
             in logcontent)
+
+    def test_upload_refereeform_by_student(self):
+        self.login()
+        self.browser.open(self.edit_path)
+        # 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')
+        self.browser.getControl("Save").click() # submit form
+        # We get a warning message
+        self.assertTrue(
+            'Uploaded file is too big' in self.browser.contents)
+        # 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')
+        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.edit_path.replace('edit', 'refereeform.pdf')
+        self.browser.open(pdf_url)
+        self.assertEqual(
+            self.browser.headers['content-type'], 'application/pdf')
+        self.assertEqual(len(self.browser.contents), 307200)
+        # There is really a file stored for the applicant
+        storage = getUtility(IExtFileStore)
+        file_id = IFileStoreNameChooser(self.applicant).chooseName(
+            attr='refereeform.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.edit_path)
+        self.assertTrue('<a href="refereeform.pdf">' in self.browser.contents)
+        # ... and on the dislay view
+        self.browser.open(self.view_path)
+        self.assertTrue('<a href="refereeform.pdf">Referee\'s Form</a>'
+            in self.browser.contents)
+
+    def test_upload_refereeform_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)
+        ctrl = self.browser.getControl(name='form.refereeform')
+        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.replace('manage', 'refereeform.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(self.applicant).chooseName(
+            attr='refereeform.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)
+        self.assertTrue('<a href="refereeform.pdf">' in self.browser.contents)
+        # ... and on the dislay view
+        self.browser.open(self.view_path)
+        self.assertTrue('<a href="refereeform.pdf">Referee\'s Form</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.futminna.applicants.browser.CustomApplicantManageFormPage'
+            ' - %s - saved: refereeform'
+            % (self.applicant.applicant_id)
+            in logcontent)
