Changeset 16059 for main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests
- Timestamp:
- 20 Apr 2020, 06:30:54 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r16058 r16059 1661 1661 mandate.params['name'] = u'John Referee' 1662 1662 mandate.params['email'] = 'aa@aa.aa' 1663 mandate.params['applicant_id'] = self.applicant.applicant_id 1663 1664 mandate.params[ 1664 1665 'redirect_path'] = '/applicants/%s/%s/addrefereereport' % ( … … 1692 1693 in self.browser.contents) 1693 1694 self.assertEqual(self.browser.url, 'http://localhost/app') 1695 return 1694 1696 1695 1697 def test_add_and_view_reports(self): … … 1697 1699 mandate.params['name'] = u'John Referee' 1698 1700 mandate.params['email'] = 'aa@aa.aa' 1699 mandate.params[ 1700 1701 mandate.params['applicant_id'] = self.applicant.applicant_id 1702 mandate.params['redirect_path'] = '/applicants/%s/%s/addrefereereport' % ( 1701 1703 container_name_1, self.applicant.application_number) 1704 mandate.params['redirect_path2'] = '' 1702 1705 self.app['mandates'].addMandate(mandate) 1703 1706 self.assertEqual(len(self.app['mandates'].keys()), 1) … … 1712 1715 self.browser.getControl(name="form.email").value = 'bb@bb.bb' 1713 1716 self.browser.getControl("Submit").click() 1714 self.assertTrue('Referee report has been saved' in self.browser.contents) 1715 self.assertEqual(self.browser.url, 'http://localhost/app') 1717 # Referee wil be redirected to a pdf file 1718 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1719 self.assertEqual(self.browser.headers['Content-Type'], 1720 'application/pdf') 1721 path = os.path.join(samples_dir(), 'referee_report.pdf') 1722 open(path, 'wb').write(self.browser.contents) 1723 print "Sample PDF referee_report.pdf written to %s" % path 1716 1724 # Report has been created 1717 1725 self.assertEqual(len(self.applicant.refereereports), 1) 1718 1726 report = self.applicant.refereereports[0] 1727 # Referee can use mandate again to download the pdf report 1728 self.browser.open('http://localhost/app/mandate?mandate_id=%s' 1729 % mandate.mandate_id) 1730 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1731 self.assertEqual(self.browser.headers['Content-Type'], 1732 'application/pdf') 1719 1733 # Managers can view the report 1720 1734 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 1725 1739 self.assertTrue('John Referee' in self.browser.contents) 1726 1740 # Managers can download a pdf slip 1727 self.browser.getLink("Download re port").click()1741 self.browser.getLink("Download referee report").click() 1728 1742 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1729 1743 self.assertEqual(self.browser.headers['Content-Type'], … … 1732 1746 open(path, 'wb').write(self.browser.contents) 1733 1747 print "Sample PDF referee_report_slip.pdf written to %s" % path 1734 # Report creation is logged 1748 # Mandate is not deleted ... 1749 self.assertEqual(len(self.app['mandates'].keys()), 1) 1750 # ... but redirect_path2 attribute has been set 1751 redirect_path2 = '/applicants/%s/%s/%s/referee_report.pdf' % ( 1752 container_name_1, 1753 self.applicant.application_number, 1754 report.r_id) 1755 self.assertEqual( 1756 self.app['mandates'].values()[0].params['redirect_path2'], 1757 redirect_path2) 1758 # Managers can delete referee reports 1759 self.browser.open(self.manage_path) 1760 self.browser.getLink("%s" % report.r_id).click() 1761 self.assertEqual(len(self.applicant.refereereports), 1) 1762 self.browser.getLink("Delete").click() 1763 self.assertEqual(len(self.applicant.refereereports), 0) 1764 self.assertTrue('Referee report removed.' in self.browser.contents) 1765 self.assertEqual(self.browser.url, self.view_path) 1766 # Report creation and deletion is logged 1735 1767 logfile = os.path.join( 1736 1768 self.app['datacenter'].storage, 'logs', 'applicants.log') … … 1739 1771 'zope.anybody - applicants.browser.RefereeReportAddFormPage - ' 1740 1772 '%s - added: %s\n' % (self.applicant.applicant_id, report.r_id) 1741 in logcontent 1742 ) 1743 # Mandate is deleted 1744 self.assertEqual(len(self.app['mandates'].keys()), 0) 1773 in logcontent) 1774 self.assertTrue( 1775 'zope.mgr - applicants.browser.RemoveRefereeReportPage - ' 1776 '%s - removed: %s\n' % (self.applicant.applicant_id, report.r_id) 1777 in logcontent) 1778 return 1745 1779 1746 1780 def test_final_submit_with_referees(self):
Note: See TracChangeset for help on using the changeset viewer.