Changeset 13950 for main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests
- Timestamp:
- 17 Jun 2016, 10:02:02 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r13886 r13950 1447 1447 layer = FunctionalLayer 1448 1448 1449 def wait_for_export_job _completed(self):1449 def wait_for_export_jobs_completed(self): 1450 1450 # helper function waiting until the current export job is completed 1451 1451 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 1456 1457 1457 1458 def test_applicants_in_container_export(self): … … 1460 1461 self.browser.open(container_path) 1461 1462 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... 1466 1468 self.browser.open(container_path + '/exports') 1467 # ... the csv filecan be downloaded ...1468 self.browser.getLink("Download" ).click()1469 # ... the both csv files can be downloaded ... 1470 self.browser.getLink("Download", index=0).click() 1469 1471 self.assertEqual(self.browser.headers['content-type'], 1470 1472 'text/csv; charset=UTF-8') 1471 1473 self.assertTrue( 1472 'filename="WAeUP.Kofa_applicants_%s.csv' % job_id in1474 'filename="WAeUP.Kofa_applicants_%s.csv' % job_ids[0] in 1473 1475 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']) 1476 1483 # ... and discarded 1477 1484 self.browser.open(container_path + '/exports') 1485 self.browser.getControl("Discard", index=0).click() 1486 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 1478 1487 self.browser.getControl("Discard").click() 1479 1488 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 1480 # Creation, downloading and discarding islogged1489 # Creation, downloading and discarding are logged 1481 1490 logfile = os.path.join( 1482 1491 self.app['datacenter'].storage, 'logs', 'datacenter.log') … … 1485 1494 'zope.mgr - applicants.browser.ExportJobContainerJobStart - ' 1486 1495 'exported: applicants (%s), job_id=%s' 1487 % (container_name_1, job_id ) in logcontent1496 % (container_name_1, job_ids[0]) in logcontent 1488 1497 ) 1489 1498 self.assertTrue( 1490 1499 'zope.mgr - applicants.browser.ExportJobContainerDownload ' 1491 1500 '- downloaded: WAeUP.Kofa_applicants_%s.csv, job_id=%s' 1492 % (job_id , job_id) in logcontent1501 % (job_ids[0], job_ids[0]) in logcontent 1493 1502 ) 1494 1503 self.assertTrue( 1495 1504 'zope.mgr - applicants.browser.ExportJobContainerOverview ' 1496 '- discarded: job_id=%s' % job_id in logcontent1505 '- discarded: job_id=%s' % job_ids[0] in logcontent 1497 1506 ) 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.