Ignore:
Timestamp:
17 Jun 2016, 10:02:02 (9 years ago)
Author:
Henrik Bettermann
Message:

Start ApplicantExporter and ApplicantPaymentExporter at the same
time when calling ExportJobContainerJobStart.

File:
1 edited

Legend:

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

    r13886 r13950  
    14471447    layer = FunctionalLayer
    14481448
    1449     def wait_for_export_job_completed(self):
     1449    def wait_for_export_jobs_completed(self):
    14501450        # helper function waiting until the current export job is completed
    14511451        manager = getUtility(IJobManager)
    1452         job_id = self.app['datacenter'].running_exports[0][0]
    1453         job = manager.get(job_id)
    1454         wait_for_result(job)
    1455         return job_id
     1452        job_ids = [i[0] for i in self.app['datacenter'].running_exports]
     1453        jobs = [manager.get(job_id) for job_id in job_ids]
     1454        for job in jobs:
     1455            wait_for_result(job)
     1456        return job_ids
    14561457
    14571458    def test_applicants_in_container_export(self):
     
    14601461        self.browser.open(container_path)
    14611462        self.browser.getLink("Export applicants").click()
    1462         self.browser.getControl("Start new export").click()
    1463 
    1464         # When the job is finished and we reload the page...
    1465         job_id = self.wait_for_export_job_completed()
     1463        self.browser.getControl("Start new exports").click()
     1464        job_ids = self.wait_for_export_jobs_completed()
     1465        # Two exports were created
     1466        self.assertEqual(len(self.app['datacenter'].running_exports), 2)
     1467       # When the jobs are finished and we reload the page...
    14661468        self.browser.open(container_path + '/exports')
    1467         # ... the csv file can be downloaded ...
    1468         self.browser.getLink("Download").click()
     1469        # ... the both csv files can be downloaded ...
     1470        self.browser.getLink("Download", index=0).click()
    14691471        self.assertEqual(self.browser.headers['content-type'],
    14701472            'text/csv; charset=UTF-8')
    14711473        self.assertTrue(
    1472             'filename="WAeUP.Kofa_applicants_%s.csv' % job_id in
     1474            'filename="WAeUP.Kofa_applicants_%s.csv' % job_ids[0] in
    14731475            self.browser.headers['content-disposition'])
    1474         self.assertEqual(len(self.app['datacenter'].running_exports), 1)
    1475         job_id = self.app['datacenter'].running_exports[0][0]
     1476        self.browser.open(container_path + '/exports')
     1477        self.browser.getLink("Download", index=1).click()
     1478        self.assertEqual(self.browser.headers['content-type'],
     1479            'text/csv; charset=UTF-8')
     1480        self.assertTrue(
     1481            'filename="WAeUP.Kofa_applicantpayments_%s.csv' % job_ids[1] in
     1482            self.browser.headers['content-disposition'])
    14761483        # ... and discarded
    14771484        self.browser.open(container_path + '/exports')
     1485        self.browser.getControl("Discard", index=0).click()
     1486        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
    14781487        self.browser.getControl("Discard").click()
    14791488        self.assertEqual(len(self.app['datacenter'].running_exports), 0)
    1480         # Creation, downloading and discarding is logged
     1489        # Creation, downloading and discarding are logged
    14811490        logfile = os.path.join(
    14821491            self.app['datacenter'].storage, 'logs', 'datacenter.log')
     
    14851494            'zope.mgr - applicants.browser.ExportJobContainerJobStart - '
    14861495            'exported: applicants (%s), job_id=%s'
    1487             % (container_name_1, job_id) in logcontent
     1496            % (container_name_1, job_ids[0]) in logcontent
    14881497            )
    14891498        self.assertTrue(
    14901499            'zope.mgr - applicants.browser.ExportJobContainerDownload '
    14911500            '- downloaded: WAeUP.Kofa_applicants_%s.csv, job_id=%s'
    1492             % (job_id, job_id) in logcontent
     1501            % (job_ids[0], job_ids[0]) in logcontent
    14931502            )
    14941503        self.assertTrue(
    14951504            'zope.mgr - applicants.browser.ExportJobContainerOverview '
    1496             '- discarded: job_id=%s' % job_id in logcontent
     1505            '- discarded: job_id=%s' % job_ids[0] in logcontent
    14971506            )
     1507        self.assertTrue(
     1508            'zope.mgr - applicants.browser.ExportJobContainerJobStart - '
     1509            'exported: applicantpayments (%s), job_id=%s'
     1510            % (container_name_1, job_ids[1]) in logcontent
     1511            )
     1512        self.assertTrue(
     1513            'zope.mgr - applicants.browser.ExportJobContainerDownload '
     1514            '- downloaded: WAeUP.Kofa_applicantpayments_%s.csv, job_id=%s'
     1515            % (job_ids[1], job_ids[1]) in logcontent
     1516            )
     1517        self.assertTrue(
     1518            'zope.mgr - applicants.browser.ExportJobContainerOverview '
     1519            '- discarded: job_id=%s' % job_ids[1] in logcontent
     1520            )
Note: See TracChangeset for help on using the changeset viewer.