Changeset 10256 for main


Ignore:
Timestamp:
30 May 2013, 18:02:31 (12 years ago)
Author:
Henrik Bettermann
Message:

Test if the transcript pdf slip can be opened.

Add date_of_birth to base data.

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

Legend:

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

    r10250 r10256  
    668668    omit_fields = (
    669669        'password', 'suspended', 'phone',
    670         'adm_code', 'suspended_comment')
     670        'adm_code', 'suspended_comment',
     671        'date_of_birth')
    671672
    672673    @property
     
    12231224    prefix = 'form'
    12241225    omit_fields = (
    1225         'password', 'suspended', 'phone',
     1226        'password', 'suspended', 'phone', 'date_of_birth',
    12261227        'adm_code', 'sex', 'suspended_comment')
    12271228
     
    17731774    note = None
    17741775    omit_fields = (
    1775         'password', 'suspended', 'phone',
     1776        'password', 'suspended', 'phone', 'date_of_birth',
    17761777        'adm_code', 'sex', 'suspended_comment')
    17771778
     
    20192020    prefix = 'form'
    20202021    omit_fields = (
    2021         'password', 'suspended', 'phone', 'adm_code', 'suspended_comment')
     2022        'password', 'suspended', 'phone', 'adm_code',
     2023        'suspended_comment', 'date_of_birth')
    20222024
    20232025    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10249 r10256  
    18341834        self.assertEqual(td[0][0]['level'].level, 100)
    18351835        self.assertEqual(td[0][0]['level'].level_session, 2005)
    1836         self.assertEqual(td[0][0]['tickets_1'][0].code, 'COURSE1')
    1837         self.assertEqual(td[0][0]['tickets_1'][1].code, 'ANYCODE')
     1836        self.assertEqual(td[0][0]['tickets_1'][0].code, 'ANYCODE')
     1837        self.assertEqual(td[0][0]['tickets_1'][1].code, 'COURSE1')
    18381838        self.assertEqual(td[1], 3.57)
    18391839        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    18411841        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    18421842        self.assertTrue('Transcript' in self.browser.contents)
     1843        # Officers can open the pdf transcript
     1844        self.browser.open(self.student_path + '/studycourse/transcript.pdf')
     1845        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1846        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    18431847
    18441848class StudentUITests(StudentsFullSetup):
     
    21942198        self.assertTrue('Course list has been registered' in self.browser.contents)
    21952199        self.assertEqual(self.student.state, 'courses registered')
     2200        # Students can open the pdf transcript
     2201        self.browser.open(self.student_path + '/studycourse/transcript.pdf')
     2202        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     2203        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    21962204        return
    21972205
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r10251 r10256  
    3838    get_signature_tables)
    3939from waeup.kofa.browser.interfaces import IPDFCreator
     40from waeup.kofa.utils.helpers import to_timezone
    4041
    4142SLIP_STYLE = [
     
    174175            entry_session = academic_sessions_vocab.getTerm(entry_session).title
    175176            f_text = formatted_text(entry_session)
     177            f_text = Paragraph(f_text, ENTRY1_STYLE)
     178            data_right.append([f_label,f_text])
     179        if not 'date_of_birth' in omit_fields:
     180            f_label = _('Date of Birth: ')
     181            f_label = Paragraph(f_label, ENTRY1_STYLE)
     182            date_of_birth = studentview.context.date_of_birth
     183            tz = getUtility(IKofaUtils).tzinfo
     184            date_of_birth = to_timezone(date_of_birth, tz)
     185            if date_of_birth is not None:
     186                date_of_birth = date_of_birth.strftime("%d/%m/%Y")
     187            f_text = formatted_text(date_of_birth)
    176188            f_text = Paragraph(f_text, ENTRY1_STYLE)
    177189            data_right.append([f_label,f_text])
     
    731743        f_label = _('Entry Session:')
    732744        f_label = Paragraph(f_label, ENTRY1_STYLE)
    733         f_text = formatted_text(view.session_dict[view.context.entry_session])
     745        f_text = formatted_text(
     746            view.session_dict.get(view.context.entry_session))
    734747        f_text = Paragraph(f_text, ENTRY1_STYLE)
    735748        contextdata.append([f_label,f_text])
     
    737750        f_label = _('Entry Mode:')
    738751        f_label = Paragraph(f_label, ENTRY1_STYLE)
    739         f_text = formatted_text(view.studymode_dict[view.context.entry_mode])
     752        f_text = formatted_text(view.studymode_dict.get(
     753            view.context.entry_mode))
    740754        f_text = Paragraph(f_text, ENTRY1_STYLE)
    741755        contextdata.append([f_label,f_text])
Note: See TracChangeset for help on using the changeset viewer.