Ignore:
Timestamp:
26 Aug 2020, 15:39:36 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement RefereesRemindPage.

File:
1 edited

Legend:

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

    r16190 r16214  
    17461746        self.browser.getControl(name="form.email").value = 'bb@bb.bb'
    17471747        self.browser.getControl("Submit").click()
    1748         # Referee wil be redirected to a pdf file
     1748        # Referee will be redirected to the frontpage
     1749        self.assertEqual(self.browser.url, 'http://localhost/app')
     1750        self.assertTrue('Your report has been successfully submitted. '
     1751                        'Please use the report link in the email again '
     1752                        'to download a pdf slip of your report.'
     1753            in self.browser.contents)
     1754        # If they use the mandate again, they will be redirected to a pdf file
     1755        self.browser.open('http://localhost/app/mandate?mandate_id=%s'
     1756            % mandate.mandate_id)
    17491757        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    17501758        self.assertEqual(self.browser.headers['Content-Type'],
     
    17621770        self.assertEqual(self.browser.headers['Content-Type'],
    17631771                         'application/pdf')
     1772        # Referees can't use another mandate for adding a new report
     1773        mandate2 = RefereeReportMandate()
     1774        mandate2.params['name'] = u'John Referee'
     1775        mandate2.params['email'] = 'aa@aa.aa'
     1776        mandate2.params['applicant_id'] = self.applicant.applicant_id
     1777        mandate2.params['redirect_path'] = '/applicants/%s/%s/addrefereereport' % (
     1778                container_name_1, self.applicant.application_number)
     1779        mandate2.params['redirect_path2'] = ''
     1780        self.app['mandates'].addMandate(mandate2)
     1781        self.browser.open('http://localhost/app/mandate?mandate_id=%s'
     1782            % mandate2.mandate_id)
     1783        self.assertTrue('You have already created a report with another mandate'
     1784            in self.browser.contents)
    17641785        # Managers can view the report
    17651786        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    17781799        print "Sample PDF referee_report_slip.pdf written to %s" % path
    17791800        # Mandate is not deleted ...
    1780         self.assertEqual(len(self.app['mandates'].keys()), 1)
     1801        self.assertEqual(len(self.app['mandates'].keys()), 2)
    17811802        # ... but redirect_path2 attribute has been set
    17821803        redirect_path2 = '/applicants/%s/%s/%s/referee_report.pdf' % (
     
    17851806                report.r_id)
    17861807        self.assertEqual(
    1787             self.app['mandates'].values()[0].params['redirect_path2'],
     1808            self.app['mandates'][mandate.mandate_id].params['redirect_path2'],
    17881809            redirect_path2)
    17891810        # Managers can delete referee reports
     
    18311852        self.browser.getControl(name="confirm_passport").value = True
    18321853        self.browser.getControl("Finally Submit").click()
    1833         mandate_id_0 = self.app['mandates'].keys()[0]
    1834         mandate_id_1 = self.app['mandates'].keys()[1]
    18351854        if self.app['mandates'].values()[0].params['name'] == 'Linda Tree':
    18361855            mandate_id_0 = self.app['mandates'].keys()[0]
     
    19201939            'invitation emails were sent.' in self.browser.contents)
    19211940        return
     1941
     1942    def test_remind_referees(self):
     1943        self.applicant.lastname = u'Mitchell'
     1944        IWorkflowState(self.applicant).setState('submitted')
     1945        # Add two referees
     1946        referee1 = RefereeEntry()
     1947        referee2 = RefereeEntry()
     1948        referee1.name = u'Linda Tree'
     1949        referee1.email = 'linda@forest.de'
     1950        referee2.name = u'Otis Stone'
     1951        referee2.email = 'otis@stones.de'
     1952        referee1.email_sent = True
     1953        referee2.email_sent = True
     1954        self.applicant.referees = [referee1, referee2]
     1955        # Managers can remind referees
     1956        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1957        self.browser.open(self.manage_path)
     1958        self.browser.getLink("Remind referees").click()
     1959        self.assertTrue('2 referee(s) have been reminded by email.'
     1960            in self.browser.contents)
     1961        logfile = os.path.join(
     1962            self.app['datacenter'].storage, 'logs', 'applicants.log')
     1963        logcontent = open(logfile).read()
     1964        self.assertTrue(
     1965            'zope.mgr - applicants.browser.RefereesRemindPage - %s - '
     1966            'email sent: otis@stones.de' % self.applicant.applicant_id
     1967            in logcontent)
     1968        if self.app['mandates'].values()[0].params['name'] == 'Linda Tree':
     1969            mandate_id_0 = self.app['mandates'].keys()[0]
     1970            mandate_id_1 = self.app['mandates'].keys()[1]
     1971        else:
     1972            mandate_id_0 = self.app['mandates'].keys()[1]
     1973            mandate_id_1 = self.app['mandates'].keys()[0]
     1974        self.assertMatches(
     1975            'Sending email from no-reply@waeup.org to linda@forest.de:'
     1976            '\nMessage:'
     1977            '\nmsg: MIME-Version: 1.0\nmsg: Content-Type: text/plain; charset="us-ascii"'
     1978            '\nmsg: Content-Transfer-Encoding: 7bit'
     1979            '\nmsg: From: Administrator <no-reply@waeup.org>'
     1980            '\nmsg: To: Linda Tree <linda@forest.de>'
     1981            '\nmsg: Reply-To: Administrator <contact@waeup.org>'
     1982            '\nmsg: Subject: Request for referee report from Sample University'
     1983            '\nmsg: '
     1984            '\nmsg: Dear Linda Tree,'
     1985            '\nmsg: '
     1986            '\nmsg: The candidate with Id app%s_372052 and name Joan Mitchell applied to'
     1987            '\nmsg: the Sample University to study Unnamed Certificate for the %s/%s session.'
     1988            '\nmsg: The candidate has listed you as referee. You are thus required to kindly use'
     1989            '\nmsg: the link below to provide your referral remarks on or before'
     1990            '\nmsg: 2016-08-12 08:32:41.619671+00:00.'
     1991            '\nmsg: '
     1992            '\nmsg: Report link: http://localhost/app/mandate?mandate_id=%s'
     1993            '\nmsg: '
     1994            '\nmsg: Thank You'
     1995            '\nmsg: '
     1996            '\nmsg: The Secretary'
     1997            '\nmsg: Post Graduate School'
     1998            '\nmsg: Sample University'
     1999            '\nmsg: '
     2000            '\nSending email from no-reply@waeup.org to otis@stones.de:'
     2001            '\nMessage:'
     2002            '\nmsg: MIME-Version: 1.0'
     2003            '\nmsg: Content-Type: text/plain; charset="us-ascii"'
     2004            '\nmsg: Content-Transfer-Encoding: 7bit'
     2005            '\nmsg: From: Administrator <no-reply@waeup.org>'
     2006            '\nmsg: To: Otis Stone <otis@stones.de>'
     2007            '\nmsg: Reply-To: Administrator <contact@waeup.org>'
     2008            '\nmsg: Subject: Request for referee report from Sample University'
     2009            '\nmsg: '
     2010            '\nmsg: Dear Otis Stone,'
     2011            '\nmsg: '
     2012            '\nmsg: The candidate with Id app%s_<6-DIGITS> and name Joan Mitchell applied to'
     2013            '\nmsg: the Sample University to study Unnamed Certificate for the %s/%s session.'
     2014            '\nmsg: The candidate has listed you as referee. You are thus required to kindly use'
     2015            '\nmsg: the link below to provide your referral remarks on or before'
     2016            '\nmsg: <YYYY-MM-DD hh:mm:ss>.<6-DIGITS>+00:00.'
     2017            '\nmsg: '
     2018            '\nmsg: Report link: http://localhost/app/mandate?mandate_id=%s'
     2019            '\nmsg: '
     2020            '\nmsg: Thank You'
     2021            '\nmsg: '
     2022            '\nmsg: The Secretary'
     2023            '\nmsg: Post Graduate School'
     2024            '\nmsg: Sample University'
     2025            '\nmsg: '
     2026            % (session_1, session_1, session_2, mandate_id_0,
     2027               session_1, session_1, session_2, mandate_id_1,),
     2028            self.get_fake_smtp_output()
     2029            )
     2030        # If a report exists, only one email is being sent to Otis Stone.
     2031        report = createObject(u'waeup.ApplicantRefereeReport')
     2032        report.r_id = 'any_id'
     2033        report.name = u'Linda Tree'
     2034        self.applicant[report.r_id] = report
     2035        self.browser.open(self.manage_path)
     2036        self.browser.getLink("Remind referees").click()
     2037        self.assertTrue('1 referee(s) have been reminded by email.'
     2038            in self.browser.contents)
     2039        return
Note: See TracChangeset for help on using the changeset viewer.