Changeset 10874


Ignore:
Timestamp:
7 Jan 2014, 07:32:50 (11 years ago)
Author:
Henrik Bettermann
Message:

Make tests turn-of-the-year-resistant.

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

Legend:

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

    r10845 r10874  
    225225        self.browser.open(self.root_path)
    226226        self.assertTrue(
    227             '<a href="http://localhost/app/applicants/app2011">'
    228             'This is the app2011 container</a>' in self.browser.contents)
    229         self.app['applicants']['app2011'].hidden = True
     227            '<a href="http://localhost/app/applicants/%s">'
     228            'This is the %s container</a>' % (container_name_1, container_name_1)
     229            in self.browser.contents)
     230        self.app['applicants'][container_name_1].hidden = True
    230231        self.browser.open(self.root_path)
    231232        # Anonymous users can't see hidden containers
    232233        self.assertFalse(
    233             '<a href="http://localhost/app/applicants/app2011">'
    234             'This is the app2011 container</a>' in self.browser.contents)
     234            '<a href="http://localhost/app/applicants/%s">'
     235            'This is the %s container</a>' % (container_name_1, container_name_1)
     236            in self.browser.contents)
    235237        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    236238        self.browser.open(self.root_path)
    237239        self.assertTrue(
    238             '<a href="http://localhost/app/applicants/app2011">'
    239             'This is the app2011 container</a>' in self.browser.contents)
     240            '<a href="http://localhost/app/applicants/%s">'
     241            'This is the %s container</a>' % (container_name_1, container_name_1)
     242            in self.browser.contents)
    240243        return
    241244
     
    339342        self.browser.getControl("Add applicants container").click()
    340343        self.assertTrue('Added:' in self.browser.contents)
    341         self.browser.getLink("app2011").click()
     344        self.browser.getLink(container_name_1).click()
    342345        self.assertTrue('Manage applicants container'
    343346            in self.browser.contents)
     
    402405        self.assertTrue(
    403406            'zope.mgr - applicants.browser.ApplicantsContainerManageFormPage - '
    404             'app2011 - saved: application_fee\n' in logcontent)
     407            '%s - saved: application_fee\n' % container_name_1 in logcontent)
    405408        self.browser.getControl("Remove selected", index=0).click()
    406409        self.assertTrue('No applicant selected' in self.browser.contents)
     
    703706        self.assertEqual(file_len, 31)
    704707        # When an applicant is removed, also the image is gone.
    705         del self.app['applicants']['app2011'][self.applicant.application_number]
     708        del self.app['applicants'][container_name_1][self.applicant.application_number]
    706709        fd = storage.getFile(file_id)
    707710        self.assertTrue(fd is None)
     
    12381241    def test_applicants_in_container_export(self):
    12391242        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    1240         container_path = 'http://localhost/app/applicants/app2011'
     1243        container_path = 'http://localhost/app/applicants/%s' % container_name_1
    12411244        self.browser.open(container_path)
    12421245        self.browser.getLink("Export applicants").click()
     
    12651268        self.assertTrue(
    12661269            'zope.mgr - applicants.browser.ExportJobContainerJobStart - '
    1267             'exported: applicants (app2011), job_id=%s'
    1268             % job_id in logcontent
     1270            'exported: applicants (%s), job_id=%s'
     1271            % (container_name_1, job_id) in logcontent
    12691272            )
    12701273        self.assertTrue(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r10842 r10874  
    880880        exporter.export([self.student], self.outfile)
    881881        result = open(self.outfile, 'rb').read()
    882         self.assertEqual(
     882        self.assertTrue(
    883883            'student_id,matric_number,display_fullname,state,certcode,'
    884884            'faccode,depcode,is_postgrad,'
     
    886886            '%s\r\n'
    887887            'A111111,234,Anna M. Tester,created,CERT1,NA,NA,0,200,2012,ug_ft,'
    888             ',,,,,,,,12.12,\r\n' % year_range_str,
    889             result
     888            % year_range_str in result
    890889            )
    891890        return
     
    906905        exporter.export_all(self.app, self.outfile)
    907906        result = open(self.outfile, 'rb').read()
    908         self.assertEqual(
     907        self.assertTrue(
    909908            'student_id,matric_number,display_fullname,state,'
    910909            'certcode,faccode,depcode,is_postgrad,'
    911910            'current_level,current_session,current_mode,'
    912911            '%s\r\nA111111,234,Anna M. Tester,created,CERT1,NA,NA,0,'
    913             '200,2012,ug_ft,,,,,,13.13,,,12.12,\r\n' % year_range_str,
    914             result
     912            '200,2012,ug_ft' % year_range_str in result
    915913            )
    916914        return
Note: See TracChangeset for help on using the changeset viewer.