Ignore:
Timestamp:
31 Oct 2012, 16:01:42 (12 years ago)
Author:
Henrik Bettermann
Message:

Add clearance_comment attribute. When CO rejects clearance she is requested to enter a comment. This comment is stored with the student object and logged. The contact form is pre-filled with the comment. When a student is cleared the comment will be automatically removed.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9452 r9484  
    12091209        self.browser.open(self.clearance_path)
    12101210        self.browser.getLink("Reject clearance").click()
     1211        self.assertEqual(
     1212            self.browser.url, self.student_path + '/reject_clearance')
     1213        # Type comment why
     1214        self.browser.getControl(name="form.clearance_comment").value = """Dear Student,
     1215You did not fill properly.
     1216"""
     1217        self.browser.getControl("Save comment").click()
    12111218        self.assertTrue('Clearance has been annulled' in self.browser.contents)
    1212         urlmessage = 'Clearance+has+been+annulled.'
    1213         # CO does now see the contact form
    1214         self.assertEqual(self.browser.url, self.student_path +
    1215             '/contactstudent?subject=%s' % urlmessage)
     1219        url = ('http://localhost/app/students/K1000000/'
     1220              'contactstudent?body=Dear+Student%2C%0AYou+did+not+fill+properly.'
     1221              '%0A&subject=Clearance+has+been+annulled.')
     1222        # CO does now see the prefilled contact form and can send a message
     1223        self.assertEqual(self.browser.url, url)
    12161224        self.assertTrue('clearance started' in self.browser.contents)
     1225        self.assertTrue('name="form.subject" size="20" type="text" '
     1226            'value="Clearance has been annulled."'
     1227            in self.browser.contents)
     1228        self.assertTrue('name="form.body" rows="10" >Dear Student,'
     1229            in self.browser.contents)
     1230        self.browser.getControl("Send message now").click()
     1231        self.assertTrue('Your message has been sent' in self.browser.contents)
     1232        # The comment has been stored ...
     1233        self.assertEqual(self.student.clearance_comment,
     1234            u'Dear Student,\nYou did not fill properly.\n')
     1235        # ... and logged
     1236        logfile = os.path.join(
     1237            self.app['datacenter'].storage, 'logs', 'students.log')
     1238        logcontent = open(logfile).read()
     1239        self.assertTrue(
     1240            'INFO - mrclear - students.browser.StudentRejectClearancePage - '
     1241            'K1000000 - comment: Dear Student,<br>You did not fill '
     1242            'properly.<br>\n' in logcontent)
    12171243        self.browser.open(self.history_path)
    12181244        self.assertTrue("Reset to 'clearance started' by My Public Name" in
     
    12211247        self.browser.open(self.clearance_path)
    12221248        self.browser.getLink("Reject clearance").click()
     1249        self.browser.getControl("Save comment").click()
    12231250        self.assertTrue('Clearance request has been rejected'
    12241251            in self.browser.contents)
    12251252        self.assertTrue('clearance started' in self.browser.contents)
    1226         # CO does now also see the contact form and can send a message
    1227         self.browser.getControl(name="form.subject").value = 'Important subject'
    1228         self.browser.getControl(name="form.body").value = 'Clearance rejected'
    1229         self.browser.getControl("Send message now").click()
    1230         self.assertTrue('Your message has been sent' in self.browser.contents)
    12311253        # The CO can't clear students if not in state
    12321254        # clearance requested
     
    12401262        self.browser.getLink("Show students").click()
    12411263        self.assertTrue(self.student_id in self.browser.contents)
     1264
     1265
     1266        # When a student is cleared the comment is automatically deleted
     1267        IWorkflowInfo(self.student).fireTransition('request_clearance')
     1268        IWorkflowInfo(self.student).fireTransition('clear')
     1269        self.assertEqual(self.student.clearance_comment, None)
     1270
    12421271
    12431272    def test_handle_courses_by_ca(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r9427 r9484  
    4343        result = open(self.outfile, 'rb').read()
    4444        self.assertTrue(
    45             'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
     45            'adm_code,clearance_comment,clearance_locked,clr_code,'
     46            'date_of_birth,email,employer,'
    4647            'firstname,lastname,matric_number,middlename,nationality,'
    4748            'perm_address,phone,reg_number,sex,student_id,suspended,password,'
    4849            'state,history,certcode,is_postgrad,current_level,current_session\r\n'
    4950
    50             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     51            'my adm code,,0,my clr code,1981-02-04#,anna@sample.com,,'
    5152            'Anna,Tester,234,M.,NG,"Studentroad 21\nLagos 123456\n",'
    5253            '+234-123-12345#,123,f,A111111,0,,created'
     
    6364        result = open(self.outfile, 'rb').read()
    6465        self.assertTrue(
    65             'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
     66            'adm_code,clearance_comment,clearance_locked,clr_code,'
     67            'date_of_birth,email,employer,'
    6668            'firstname,lastname,matric_number,middlename,nationality,'
    6769            'perm_address,phone,reg_number,sex,student_id,suspended,password,'
    6870            'state,history,certcode,is_postgrad,current_level,current_session\r\n'
    6971
    70             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     72            'my adm code,,0,my clr code,1981-02-04#,anna@sample.com,,'
    7173            'Anna,Tester,234,M.,NG,"Studentroad 21\nLagos 123456\n",'
    7274            '+234-123-12345#,123,f,A111111,0,,created'
     
    8284        result = open(self.outfile, 'rb').read()
    8385        self.assertTrue(
    84             'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
     86            'adm_code,clearance_comment,clearance_locked,clr_code,'
     87            'date_of_birth,email,employer,'
    8588            'firstname,lastname,matric_number,middlename,nationality,'
    8689            'perm_address,phone,reg_number,sex,student_id,suspended,password,'
    8790            'state,history,certcode,is_postgrad,current_level,current_session\r\n'
    8891
    89             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     92            'my adm code,,0,my clr code,1981-02-04#,anna@sample.com,,'
    9093            'Anna,Tester,234,M.,NG,"Studentroad 21\nLagos 123456\n",'
    9194            '+234-123-12345#,123,f,A111111,0,,created'
Note: See TracChangeset for help on using the changeset viewer.