Ignore:
Timestamp:
26 Oct 2015, 17:18:16 (9 years ago)
Author:
Henrik Bettermann
Message:

Extend personal data form and force student to fill the form.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students/tests
Files:
1 added
2 edited

Legend:

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

    r13059 r13351  
    2121import pytz
    2222import grok
     23from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    2324from datetime import datetime, timedelta, date
    2425from mechanize import LinkNotFoundError
     
    3334from waeup.kofa.browser.tests.test_pdf import samples_dir
    3435from waeup.aaue.testing import FunctionalLayer
     36
     37SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    3538
    3639
     
    493496        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    494497        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     498
     499    def test_student_clearance(self):
     500        # Student cant login if their password is not set
     501        IWorkflowInfo(self.student).fireTransition('admit')
     502        self.browser.open(self.login_path)
     503        self.browser.getControl(name="form.login").value = self.student_id
     504        self.browser.getControl(name="form.password").value = 'spwd'
     505        self.browser.getControl("Login").click()
     506        self.assertMatches(
     507            '...You logged in...', self.browser.contents)
     508        # Admitted student can upload a passport picture
     509        self.browser.open(self.student_path + '/change_portrait')
     510        ctrl = self.browser.getControl(name='passportuploadedit')
     511        file_obj = open(SAMPLE_IMAGE, 'rb')
     512        file_ctrl = ctrl.mech_control
     513        file_ctrl.add_file(file_obj, filename='my_photo.jpg')
     514        self.browser.getControl(
     515            name='upload_passportuploadedit').click()
     516        self.assertTrue(
     517            'src="http://localhost/app/students/E1000000/passport.jpg"'
     518            in self.browser.contents)
     519        # Student is redirected to the personal data form because
     520        # personal data form is not properly filled.
     521        self.browser.open(self.student_path + '/start_clearance')
     522        self.assertMatches('...Personal data form is not properly filled...',
     523                           self.browser.contents)
     524        self.assertEqual(self.browser.url, self.student_path + '/edit_personal')
     525        self.student.father_name = u'Rudolf'
     526        self.browser.open(self.student_path + '/start_clearance')
     527        self.assertMatches('...<h1 class="kofa-content-label">Start clearance</h1>...',
     528                   self.browser.contents)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_export.py

    r13112 r13351  
    4747        result = open(self.outfile, 'rb').read()
    4848        self.assertMatches(
    49             'adm_code,alr_date,alr_fname,alr_no,alr_results,'
    50             'clr_code,date_of_birth,def_adm,disabled,email,emp2_end,'
    51             'emp2_position,emp2_reason,emp2_start,emp_end,emp_position,'
    52             'emp_reason,emp_start,employer,employer2,firstname,former_matric,'
    53             'fst_sit_date,fst_sit_fname,fst_sit_no,fst_sit_results,'
    54             'fst_sit_type,hq2_degree,hq2_disc,hq2_matric_no,hq2_school,'
    55             'hq2_session,hq2_type,hq_degree,hq_disc,hq_fname,hq_matric_no,'
    56             'hq_school,hq_session,hq_type,is_staff,lastname,lga,'
    57             'marit_stat,matric_number,middlename,nationality,'
    58             'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
    59             'nysc_lga,nysc_location,nysc_year,officer_comment,'
    60             'perm_address,personal_updated,phone,physical_clearance_date,reg_number,'
    61             'religion,scd_sit_date,scd_sit_fname,scd_sit_no,'
    62             'scd_sit_results,scd_sit_type,sex,student_id,'
    63             'suspended,suspended_comment,password,state,history,certcode,is_postgrad,'
    64             'current_level,current_session\r\nmy adm code,,,,'
    65             '"[(\'printing_craft_practice\', \'A1\')]",my clr code,1981-02-04#,,,'
    66             'anna@sample.com,,,,,,,,,,,Anna,,,,,"[(\'printing_craft_practice\', \'A1\')]"'
    67             ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,'
    68             '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,123,,,,,'
    69             '"[(\'printing_craft_practice\', \'A1\')]",,f,A111111,0,,,created,'
    70             '[u\'2012-11-06 13:16:41 WAT - Record created by system\'],'
     49            'adm_code,alr_date,alr_fname,alr_no,alr_results,clr_code,'
     50            'date_of_birth,def_adm,disabled,email,emp2_end,emp2_position,'
     51            'emp2_reason,emp2_start,emp_end,emp_position,emp_reason,'
     52            'emp_start,employer,employer2,father_address,father_name,'
     53            'father_phone,father_work,firstname,former_matric,fst_sit_date,'
     54            'fst_sit_fname,fst_sit_no,fst_sit_results,fst_sit_type,hq2_degree,'
     55            'hq2_disc,hq2_matric_no,hq2_school,hq2_session,hq2_type,'
     56            'hq_degree,hq_disc,hq_fname,hq_matric_no,hq_school,hq_session,'
     57            'hq_type,is_staff,lastname,lga,marit_stat,matric_number,'
     58            'middlename,mother_address,mother_name,mother_phone,'
     59            'mother_work,nationality,next_kin_address,next_kin_name,'
     60            'next_kin_phone,next_kin_relation,nysc_lga,nysc_location,'
     61            'nysc_year,officer_comment,perm_address,personal_updated,'
     62            'phone,phone_personal,physical_clearance_date,reg_number,'
     63            'religion,scd_sit_date,scd_sit_fname,scd_sit_no,scd_sit_results,'
     64            'scd_sit_type,sex,student_id,suspended,suspended_comment,password,'
     65            'state,history,certcode,is_postgrad,current_level,current_session'
     66            '\r\n'
     67            'my adm code,,,,"[(\'printing_craft_practice\', \'A1\')]",'
     68            'my clr code,1981-02-04#,,,anna@sample.com,,,,,,,,,,,,,,,Anna,,,,,'
     69            '"[(\'printing_craft_practice\', \'A1\')]",,,,,,,,,,,,,,,,Tester,,,'
     70            '234,M.,,,,,NG,,,,,,,,,"Studentroad 21\nLagos 123456\n",,'
     71            '+234-123-12345#,,,123,,,,,'
     72            '"[(\'printing_craft_practice\', \'A1\')]",,f,A111111,0,,,'
     73            'created,[u\'2015-10-26 17:45:56 WAT - Record created by system\'],'
    7174            'CERT1,0,200,2012\r\n',
    7275            result
Note: See TracChangeset for help on using the changeset viewer.