Changeset 14579 for main/waeup.aaue


Ignore:
Timestamp:
23 Feb 2017, 17:57:10 (8 years ago)
Author:
Henrik Bettermann
Message:

Alumni records have to be imported into several containers.
Therefore a string must be added to their registration number
to make it unique.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/applicants
Files:
2 edited

Legend:

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

    r14486 r14579  
    469469        return
    470470
     471    @property
     472    def _postfix(self):
     473        """Alumni records have to be imported into several containers.
     474        Therefore a string must be added to their registration number
     475        to make it unique.
     476        """
     477        if self.context.prefix in ('trans', 'cert'):
     478            return self.context.code
     479        return ''
     480
    471481class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage):
    472482
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py

    r14486 r14579  
    143143        self.assertTrue("Dispatch Address" in self.browser.contents)
    144144
    145     def test_certificate_request_manage(self):
     145    def _prepare_cert_container(self):
    146146        # Add cert applicants container
    147147        self.certcontainer = ApplicantsContainer()
    148         self.certcontainer.mode = 'create'
     148        self.certcontainer.mode = 'update'
    149149        self.certcontainer.code = u'cert%s' % session_1
    150150        self.certcontainer.prefix = u'cert'
     
    161161        certapplicant.firstname = u'Anna'
    162162        certapplicant.lastname = u'Post'
     163        certapplicant.reg_number = u'1234%s' % self.certcontainer.code
    163164        self.app['applicants'][self.certcontainer.code].addApplicant(certapplicant)
    164165        self.certapplication_number = certapplicant.application_number
    165166        self.certapplicant = self.app['applicants'][self.certcontainer.code][
    166167            self.certapplication_number]
     168        self.certcontainer_path = ('http://localhost/app/applicants/cert%s'
     169            % session_1)
    167170        self.certapplicant_path = ('http://localhost/app/applicants/cert%s/%s'
    168171            % (session_1, self.certapplication_number))
     172
     173    def test_certificate_request_manage(self):
     174        self._prepare_cert_container()
    169175        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    170176        self.browser.open(self.certapplicant_path)
    171177        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    172178        self.assertTrue("Dispatch Address" in self.browser.contents)
     179
     180    def test_certificate_request_update(self):
     181        self._prepare_cert_container()
     182        #IWorkflowState(self.applicant).setState('initialized')
     183        self.browser.open(self.certcontainer_path + '/register')
     184        self.browser.getControl(name="form.lastname").value = 'post'
     185        self.browser.getControl(name="form.reg_number").value = '1234'
     186        self.browser.getControl(name="form.email").value = 'new@yy.zz'
     187        self.browser.getControl("Send login credentials").click()
     188        # Yeah, we succeded ...
     189        self.assertTrue('Your registration was successful.'
     190            in self.browser.contents)
    173191
    174192    def test_pg_application_manage(self):
Note: See TracChangeset for help on using the changeset viewer.