| 1 | from waeup.custom.testing import FunctionalLayer |
|---|
| 2 | from waeup.sirp.students.tests.test_browser import StudentsFullSetup |
|---|
| 3 | from waeup.custom.configuration import SessionConfiguration |
|---|
| 4 | |
|---|
| 5 | class StudentUITests(StudentsFullSetup): |
|---|
| 6 | # Tests for customized student class views and pages |
|---|
| 7 | |
|---|
| 8 | layer = FunctionalLayer |
|---|
| 9 | |
|---|
| 10 | def test_manage_payments(self): |
|---|
| 11 | # Add missing configuration data |
|---|
| 12 | self.app['configuration']['2004'].gown_fee = 150 |
|---|
| 13 | self.app['configuration']['2004'].transfer_fee = 90 |
|---|
| 14 | self.app['configuration']['2004'].clearance_fee = 120 |
|---|
| 15 | self.app['configuration']['2004'].maint_fee = 180 |
|---|
| 16 | |
|---|
| 17 | # Managers can add online payment tickets |
|---|
| 18 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
|---|
| 19 | self.browser.open(self.payments_student_path) |
|---|
| 20 | self.browser.getControl("Add online payment ticket").click() |
|---|
| 21 | self.browser.getControl("Create ticket").click() |
|---|
| 22 | self.assertMatches('...Amount could not be determined...', |
|---|
| 23 | self.browser.contents) |
|---|
| 24 | self.browser.open(self.manage_student_path) |
|---|
| 25 | self.browser.getControl(name="transition").value = ['admit'] |
|---|
| 26 | self.browser.getControl("Save").click() |
|---|
| 27 | self.browser.getControl(name="transition").value = ['start_clearance'] |
|---|
| 28 | self.browser.getControl("Save").click() |
|---|
| 29 | self.browser.getControl(name="transition").value = ['request_clearance'] |
|---|
| 30 | self.browser.getControl("Save").click() |
|---|
| 31 | self.browser.getControl(name="transition").value = ['clear'] |
|---|
| 32 | self.browser.getControl("Save").click() |
|---|
| 33 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 34 | self.browser.getControl("Create ticket").click() |
|---|
| 35 | self.assertMatches('...ticket created...', |
|---|
| 36 | self.browser.contents) |
|---|
| 37 | self.browser.open(self.manage_student_path) |
|---|
| 38 | self.browser.getControl( |
|---|
| 39 | name="transition").value = ['pay_first_school_fee'] |
|---|
| 40 | self.browser.getControl("Save").click() |
|---|
| 41 | self.browser.getControl(name="transition").value = ['reset6'] |
|---|
| 42 | self.browser.getControl("Save").click() |
|---|
| 43 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 44 | self.browser.getControl("Create ticket").click() |
|---|
| 45 | self.assertMatches('...This payment ticket already exists...', |
|---|
| 46 | self.browser.contents) |
|---|
| 47 | # Remove all payments so that we can add a school fee payment again |
|---|
| 48 | for payment in self.student['payments'].keys(): |
|---|
| 49 | del self.student['payments'][payment] |
|---|
| 50 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 51 | self.browser.getControl("Create ticket").click() |
|---|
| 52 | self.assertMatches('...ticket created...', |
|---|
| 53 | self.browser.contents) |
|---|
| 54 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 55 | self.browser.getControl(name="form.p_category").value = ['gown'] |
|---|
| 56 | self.browser.getControl("Create ticket").click() |
|---|
| 57 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 58 | self.browser.getControl(name="form.p_category").value = ['transfer'] |
|---|
| 59 | self.browser.getControl("Create ticket").click() |
|---|
| 60 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 61 | self.browser.getControl( |
|---|
| 62 | name="form.p_category").value = ['bed_allocation'] |
|---|
| 63 | self.browser.getControl("Create ticket").click() |
|---|
| 64 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 65 | self.browser.getControl( |
|---|
| 66 | name="form.p_category").value = ['hostel_maintenance'] |
|---|
| 67 | self.browser.getControl("Create ticket").click() |
|---|
| 68 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 69 | self.browser.getControl(name="form.p_category").value = ['clearance'] |
|---|
| 70 | self.browser.getControl("Create ticket").click() |
|---|
| 71 | self.certificate.study_mode = 'ug_pt' |
|---|
| 72 | self.browser.open(self.payments_student_path + '/addop') |
|---|
| 73 | self.browser.getControl(name="form.p_category").value = ['schoolfee'] |
|---|
| 74 | self.browser.getControl("Create ticket").click() |
|---|
| 75 | self.assertMatches('...Amount could not be determined...', |
|---|
| 76 | self.browser.contents) |
|---|
| 77 | |
|---|
| 78 | # If the session configuration doesn't exist and error message will |
|---|
| 79 | # be shown |
|---|
| 80 | del self.app['configuration']['2004'] |
|---|
| 81 | self.browser.open(self.payments_student_path) |
|---|
| 82 | self.browser.getControl("Add online payment ticket").click() |
|---|
| 83 | self.browser.getControl("Create ticket").click() |
|---|
| 84 | self.assertMatches('...Session configuration object is not...', |
|---|
| 85 | self.browser.contents) |
|---|
| 86 | |
|---|
| 87 | |
|---|