Ignore:
Timestamp:
26 Jun 2016, 05:35:30 (9 years ago)
Author:
Henrik Bettermann
Message:

Delete mandate after report creation.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
1 added
2 edited

Legend:

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

    r13991 r13992  
    15081508class RefereeReportAddFormPage(KofaAddFormPage):
    15091509    """Add-form to add an referee report. This form
    1510     is protected by a mandate. (not yet ready)
     1510    is protected by a mandate.
    15111511    """
    15121512    grok.context(IApplicant)
     
    15151515    form_fields = grok.AutoFields(
    15161516        IApplicantRefereeReport).omit('creation_date')
     1517    grok.template('refereereportpage')
    15171518    label = _('Add referee report')
    15181519    pnav = 3
     
    15291530        # Check mandate
    15301531        form = self.request.form
    1531         mandate_id = form.get('mandate_id', None)
    1532         mandates = grok.getSite()['mandates']
    1533         mandate = mandates.get(mandate_id, None)
     1532        self.mandate_id = form.get('mandate_id', None)
     1533        self.mandates = grok.getSite()['mandates']
     1534        mandate = self.mandates.get(self.mandate_id, None)
    15341535        if mandate is None and not self.request.form.get('form.actions.submit'):
    15351536            self.flash(_('No mandate.'), type='warning')
     
    15581559        self.flash(_('Referee report has been saved. Thank you!'))
    15591560        self.context.writeLogMessage(self, 'added: %s' % report.r_id)
    1560         # XXX: Delete mandate
    1561         # XXX: Send email
     1561        # Delete mandate
     1562        del self.mandates[self.mandate_id]
    15621563        self.redirect(self.application_url())
    15631564        return
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r13991 r13992  
    15701570                container_name_1, self.applicant.application_number)
    15711571        self.app['mandates'].addMandate(mandate)
     1572        self.assertEqual(len(self.app['mandates'].keys()), 1)
    15721573        # Let's open the add form page via the mandate view
    15731574        self.browser.open('http://localhost/app/mandate?mandate_id=%s'
    15741575            % mandate.mandate_id)
     1576        self.assertTrue('Joan None' in self.browser.contents)
     1577        # Report can't be saved without required fields
     1578        self.browser.getControl(name="form.email").value = ''
     1579        self.browser.getControl("Submit").click()
     1580        self.assertTrue('Required input is missing' in self.browser.contents)
     1581        self.browser.getControl(name="form.email").value = 'bb@bb.bb'
    15751582        self.browser.getControl("Submit").click()
    15761583        self.assertTrue('Referee report has been saved' in self.browser.contents)
     
    15951602            in logcontent
    15961603            )
     1604        # Mandate is deleted
     1605        self.assertEqual(len(self.app['mandates'].keys()), 0)
Note: See TracChangeset for help on using the changeset viewer.