Ignore:
Timestamp:
19 Feb 2017, 07:38:38 (8 years ago)
Author:
Henrik Bettermann
Message:

Pin waeup.kofa 1.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_browser.py

    r12482 r14557  
    2424from zope.catalog.interfaces import ICatalog
    2525from zope.intid.interfaces import IIntIds
     26from hurry.workflow.interfaces import IWorkflowState
    2627from kofacustom.sampleuni.testing import FunctionalLayer
    27 from waeup.kofa.schoolgrades import ResultEntry
    28 from waeup.kofa.utils.utils import KofaUtils
     28from waeup.kofa.browser.tests.test_pdf import samples_dir
    2929from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
    3030from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup
     
    5555        applicant.lastname = u'Tester'
    5656        applicant.middlename = u'M.'
     57        applicant.nationality = u'NG'
    5758        applicant.date_of_birth = datetime.date(1981, 2, 4)
    5859        applicant.sex = 'f'
     
    6364        applicant.course_admitted = self.certificate
    6465        applicant.notice = u'Some notice\nin lines.'
     66        applicant.screening_score = 98
     67        applicant.screening_venue = u'Exam Room'
     68        applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'
    6569        applicant.password = 'any password'
    66         result_entry = ResultEntry(
    67             KofaUtils.EXAM_SUBJECTS_DICT.keys()[0],
    68             KofaUtils.EXAM_GRADES[0][0]
    69             )
    70         applicant.school_grades = [
    71             result_entry]
    7270        return applicant
    7371
    74     def test_export_reimport_all(self):
    75         # we can export all applicants in a portal
    76         # set values we can expect in export file
    77         self.applicant = self.setup_applicant(self.applicant)
    78         exporter = CustomApplicantExporter()
    79         exporter.export_all(self.app, self.outfile)
    80         result = open(self.outfile, 'rb').read()
    81         self.assertTrue(
    82             'applicant_id,application_date,application_number,course1,course2,'
    83             'course_admitted,date_of_birth,display_fullname,email,firstname,'
    84             'history,lastname,locked,middlename,notice,password,phone,'
    85             'reg_number,sex,special_application,state,'
    86             'student_id,suspended,container_code\r\n'
    87             'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
    88             'Anna M. Tester,anna@sample.com,Anna,'
    89             in result)
    90         self.assertTrue(
    91             'Application initialized by system\'],'
    92             'Tester,0,M.,"Some notice\nin lines.",any password,'
    93             '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n'
    94             in result)
    95         # We can import the same file if we ignore some columns.
    96         # Since the applicants_catalog hasn't been notified, the same
    97         # record with same reg_number can be imported twice.
    98         processor = CustomApplicantProcessor()
    99         result = processor.doImport(
    100             self.outfile,
    101             ['ignore_applicant_id','application_date',
    102             'ignore_application_number','course1','course2',
    103             'course_admitted','date_of_birth',
    104             'ignore_display_fullname','email','firstname',
    105             'ignore_history','lastname','locked','middlename',
    106             'notice','password','phone',
    107             'reg_number','sex','special_application','state',
    108             'student_id','suspended','container_code'],
    109             mode='create')
    110         num_succ, num_fail, finished_path, failed_path = result
    111         #content = open(failed_path).read()
    112         self.assertEqual(num_succ,1)
    113         self.assertEqual(num_fail,0)
    114         return
     72class ApplicantsContainerUITests(ApplicantsFullSetup):
     73    # Tests for ApplicantsContainer class views and pages
     74
     75    layer = FunctionalLayer
     76
     77    def test_application_slip(self):
     78        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     79        self.slip_path = self.view_path + '/application_slip.pdf'
     80        self.browser.open(self.manage_path)
     81        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     82        self.fill_correct_values()
     83        self.browser.getControl("Save").click()
     84        IWorkflowState(self.applicant).setState('submitted')
     85        self.browser.open(self.manage_path)
     86        self.browser.getLink("Download application slip").click()
     87        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     88        self.assertEqual(self.browser.headers['Content-Type'],
     89                         'application/pdf')
     90        path = os.path.join(samples_dir(), 'application_slip.pdf')
     91        open(path, 'wb').write(self.browser.contents)
     92        print "Sample application_slip.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.