Changeset 10843


Ignore:
Timestamp:
11 Dec 2013, 13:22:38 (11 years ago)
Author:
Henrik Bettermann
Message:

Add test which ensures that no error occurs if we unselect special_application.

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

Legend:

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

    r10832 r10843  
    893893        return
    894894
    895     def test_pay_special_fee(self):
     895    def prepare_special_container(self):
    896896        # Add special application container
    897897        container_name = u'special%s' % session_1
     
    913913        # because managers are allowed to edit this required field
    914914        applicant.reg_number = u'12345'
     915        self.special_applicant = applicant
    915916        self.app['applicants'][container_name].addApplicant(applicant)
    916917        IUserAccount(
     
    922923        configuration.transcript_fee = 200.0
    923924        self.app['configuration'].addSessionConfiguration(configuration)
     925
     926
     927    def test_pay_special_fee(self):
     928        self.prepare_special_container()
    924929        # Login
    925930        self.browser.open(self.login_path)
    926931        self.browser.getControl(
    927             name="form.login").value = applicant.applicant_id
     932            name="form.login").value = self.special_applicant.applicant_id
    928933        self.browser.getControl(name="form.password").value = 'apwd'
    929934        self.browser.getControl("Login").click()
     935        applicant_path = self.browser.url
    930936        self.browser.getLink("Edit application record").click()
    931937        self.browser.getControl(name="form.firstname").value = 'John'
     
    947953        self.assertTrue(
    948954            '<span>200.0</span>' in self.browser.contents)
    949         return
    950 
     955        self.browser.getLink("Logout").click()
     956        # Login as manager
     957        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     958        self.browser.open(applicant_path + '/manage')
     959        # When unselecting special_application, the payment ticket
     960        # can still be created.
     961        self.browser.getControl(name="form.special_application").value = [
     962            '']
     963        self.browser.getControl("Save").click()
     964        self.browser.getControl("Add online payment ticket").click()
     965        self.assertMatches('...Payment ticket created...',
     966                           self.browser.contents)
     967        self.assertMatches('...<span>--</span>...',
     968                           self.browser.contents)
     969        return
    951970
    952971    def test_duplicate_choice(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py

    r10841 r10843  
    6868            return
    6969        payment.amount_auth = session_config.application_fee
     70        if payment.amount_auth in (0.0, None):
     71            return _('Amount could not be determined.'), None
    7072        return
    7173
Note: See TracChangeset for help on using the changeset viewer.