Ignore:
Timestamp:
5 Sep 2018, 10:58:59 (6 years ago)
Author:
Henrik Bettermann
Message:

Applicants have to pay an admission checking fee before they can view their admission 'status'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/tests/test_browser.py

    r15000 r15123  
    3131from kofacustom.edopoly.applicants.export import CustomApplicantExporter
    3232from kofacustom.edopoly.applicants.batching import CustomApplicantProcessor
     33from kofacustom.edopoly.configuration import CustomSessionConfiguration
    3334
    3435class CustomApplicantUITests(ApplicantsFullSetup):
     
    3637
    3738    layer = FunctionalLayer
     39
     40    def test_pay_admission_checking_fee(self):
     41        IWorkflowState(self.applicant).setState('admitted')
     42        self.applicant.screening_score = 55
     43        self.applicant.course_admitted = self.certificate
     44        self.login()
     45        # SessionConfiguration is not set, thus admission checking payment
     46        # is not necessary. Screening results and course admitted are visible.
     47        self.assertFalse(
     48            'Add admission checking payment ticket' in self.browser.contents)
     49        self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents)
     50        self.assertTrue('<span>55</span>' in self.browser.contents)
     51        configuration = CustomSessionConfiguration()
     52        configuration.academic_session = datetime.datetime.now().year - 2
     53        self.app['configuration'].addSessionConfiguration(configuration)
     54        # Admission checking fee is 0, thus admission checking payment
     55        # is not necessary. Screening results and course admitted are visible.
     56        self.browser.open(self.view_path)
     57        self.assertFalse(
     58            'Add admission checking payment ticket' in self.browser.contents)
     59        self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents)
     60        self.assertTrue('<span>55</span>' in self.browser.contents)
     61        configuration.admchecking_fee = 22.0
     62        # Admission checking payment button is now visible, but screening results
     63        # and course admitted are not.
     64        self.browser.open(self.view_path)
     65        self.assertTrue(
     66            'Add admission checking payment ticket' in self.browser.contents)
     67        self.assertFalse('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents)
     68        self.assertFalse('<span>55</span>' in self.browser.contents)
     69        # Application slip can't be downloaded
     70        self.assertFalse('Download application slip' in self.browser.contents)
     71        slip_path = self.view_path + '/application_slip.pdf'
     72        self.browser.open(slip_path)
     73        self.assertTrue(
     74            'Please pay admission checking fee before trying to download'
     75            in self.browser.contents)
     76        # Pay admission checking fee.
     77        self.browser.getControl("Add admission checking").click()
     78        p_id = self.applicant.keys()[0]
     79        self.applicant[p_id].p_state = 'paid'
     80        # Screening results and course admitted are visible after payment.
     81        self.browser.open(self.view_path)
     82        self.assertFalse(
     83            'Add admission checking payment ticket' in self.browser.contents)
     84        self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents)
     85        self.assertTrue('<span>55</span>' in self.browser.contents)
     86        # Application slip can be downloaded again.
     87        self.browser.getLink("Download application slip").click()
     88        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     89        self.assertEqual(self.browser.headers['Content-Type'],
     90                         'application/pdf')
     91        return
    3892
    3993class ApplicantExporterTest(ApplicantImportExportSetup):
Note: See TracChangeset for help on using the changeset viewer.