Ignore:
Timestamp:
6 Nov 2012, 12:23:05 (12 years ago)
Author:
Henrik Bettermann
Message:

Fix exporter test.

Show personal_updated on NigeriaStudentPersonalDisplayFormPage? like in base package.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py

    r9554 r9562  
    7474    """ Page to display student personal data
    7575    """
    76     form_fields = grok.AutoFields(INigeriaStudentPersonal).omit('personal_updated')
     76    form_fields = grok.AutoFields(INigeriaStudentPersonal)
    7777    form_fields['perm_address'].custom_widget = BytesDisplayWidget
    7878    form_fields['next_kin_address'].custom_widget = BytesDisplayWidget
     79    form_fields[
     80        'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    7981
    8082class NigeriaStudentPersonalEditFormPage(StudentPersonalEditFormPage):
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py

    r9536 r9562  
    1919import shutil
    2020import tempfile
     21from datetime import datetime, timedelta
    2122from StringIO import StringIO
    2223from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo
     
    258259            'acc_let deleted'
    259260            in self.browser.contents)
     261
     262    def test_student_expired_personal_data(self):
     263        # Login
     264        delta = timedelta(days=180)
     265        self.student.personal_updated = datetime.utcnow() - delta
     266        self.browser.open(self.login_path)
     267        self.browser.getControl(name="form.login").value = self.student_id
     268        self.browser.getControl(name="form.password").value = 'spwd'
     269        self.browser.getControl("Login").click()
     270        self.assertEqual(self.browser.url, self.student_path)
     271        self.assertTrue(
     272            'You logged in' in self.browser.contents)
     273        # Students don't see personal_updated field in edit form
     274        self.browser.open(self.edit_personal_path)
     275        self.assertFalse('Updated' in self.browser.contents)
     276        self.browser.open(self.personal_path)
     277        self.assertTrue('Updated' in self.browser.contents)
     278        self.browser.getLink("Logout").click()
     279        delta = timedelta(days=181)
     280        self.student.personal_updated = datetime.utcnow() - delta
     281        self.browser.open(self.login_path)
     282        self.browser.getControl(name="form.login").value = self.student_id
     283        self.browser.getControl(name="form.password").value = 'spwd'
     284        self.browser.getControl("Login").click()
     285        self.assertEqual(self.browser.url, self.edit_personal_path)
     286        self.assertTrue(
     287            'Your personal data record expired' in self.browser.contents)
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py

    r9535 r9562  
    4545        exporter.export_all(self.app, self.outfile)
    4646        result = open(self.outfile, 'rb').read()
    47         self.assertTrue(
     47        self.assertMatches(
    4848            'adm_code,alr_date,alr_fname,alr_no,alr_results,clearance_locked,'
    4949            'clr_code,date_of_birth,def_adm,disabled,email,emp2_end,'
     
    5252            'fst_sit_date,fst_sit_fname,fst_sit_no,fst_sit_results,'
    5353            'fst_sit_type,hq2_degree,hq2_disc,hq2_matric_no,hq2_school,'
    54             'hq2_session,hq2_type,hq_degree,hq_disc,hq_matric_no,hq_school,'
    55             'hq_session,hq_type,is_staff,lastname,lga,marit_stat,'
    56             'matric_number,middlename,nationality,next_kin_address,'
    57             'next_kin_name,next_kin_relation,nysc_lga,nysc_location,'
    58             'nysc_year,officer_comment,'
    59             'perm_address,phone,reg_number,religion,scd_sit_date,'
    60             'scd_sit_fname,scd_sit_no,scd_sit_results,scd_sit_type,sex,'
    61             'student_id,suspended,password,state,history,certcode,'
    62             'is_postgrad,current_level,current_session\r\n'
    63 
    64             'my adm code,,,,"[(\'visual_art\', \'A1\')]",0,my clr code,'
    65             '1981-02-04#,,,anna@sample.com,,,,,,,,,,,Anna,,,,,'
    66             '"[(\'visual_art\', \'A1\')]",,,,,,,,,,,,,,,Tester,,,234,M.,NG'
    67             ',,,,,,,,"Studentroad 21\nLagos 123456\n",+234-123-12345#,123'
    68             ',,,,,"[(\'visual_art\', \'A1\')]",,f,A111111,0,,created,'
    69             in result
     54            'hq2_session,hq2_type,hq_degree,hq_disc,hq_fname,hq_matric_no,'
     55            'hq_school,hq_session,hq_type,is_staff,lastname,lga,'
     56            'marit_stat,matric_number,middlename,nationality,'
     57            'next_kin_address,next_kin_name,next_kin_relation,'
     58            'nysc_lga,nysc_location,nysc_year,officer_comment,'
     59            'perm_address,personal_updated,phone,reg_number,'
     60            'religion,scd_sit_date,scd_sit_fname,scd_sit_no,'
     61            'scd_sit_results,scd_sit_type,sex,student_id,'
     62            'suspended,password,state,history,certcode,is_postgrad,'
     63            'current_level,current_session\r\nmy adm code,,,,'
     64            '"[(\'visual_art\', \'A1\')]",0,my clr code,1981-02-04#,,,'
     65            'anna@sample.com,,,,,,,,,,,Anna,,,,,"[(\'visual_art\', \'A1\')]"'
     66            ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,'
     67            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,,,,,'
     68            '"[(\'visual_art\', \'A1\')]",,f,A111111,0,,created,'
     69            '[u\'2012-11-06 13:16:41 WAT - Record created by system\'],'
     70            'CERT1,0,200,2012\r\n',
     71            result
    7072            )
    7173        return
Note: See TracChangeset for help on using the changeset viewer.