source: main/waeup.custom/trunk/src/waeup/custom/students/tests.py @ 7420

Last change on this file since 7420 was 7419, checked in by Henrik Bettermann, 13 years ago

Adjust custom package to the changes made in the base package.

Set svn properties and harmonize copyright statement.

  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1## $Id: tests.py 7419 2011-12-21 07:59:29Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18from waeup.custom.testing import FunctionalLayer
19from waeup.sirp.students.tests.test_browser import StudentsFullSetup
20from waeup.custom.configuration import SessionConfiguration
21
22class StudentUITests(StudentsFullSetup):
23    # Tests for customized student class views and pages
24
25    layer = FunctionalLayer
26
27    def test_manage_payments(self):
28        # Add missing configuration data
29        self.app['configuration']['2004'].gown_fee = 150
30        self.app['configuration']['2004'].transfer_fee = 90
31        self.app['configuration']['2004'].clearance_fee = 120
32        self.app['configuration']['2004'].maint_fee = 180
33
34        # Managers can add online payment tickets
35        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
36        self.browser.open(self.payments_student_path)
37        self.browser.getControl("Add online payment ticket").click()
38        self.browser.getControl("Create ticket").click()
39        self.assertMatches('...Amount could not be determined...',
40                           self.browser.contents)
41        self.browser.open(self.manage_student_path)
42        self.browser.getControl(name="transition").value = ['admit']
43        self.browser.getControl("Save").click()
44        self.browser.getControl(name="transition").value = ['start_clearance']
45        self.browser.getControl("Save").click()
46        self.browser.getControl(name="transition").value = ['request_clearance']
47        self.browser.getControl("Save").click()
48        self.browser.getControl(name="transition").value = ['clear']
49        self.browser.getControl("Save").click()
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        ctrl = self.browser.getControl(name='val_id')
55        value = ctrl.options[0]
56        self.browser.getLink(value).click()
57        self.assertMatches('...Amount Authorized...',
58                           self.browser.contents)
59        #payment_url = self.browser.url
60        #self.browser.open(payment_url)
61        self.browser.getLink("Request callback").click()
62        self.assertMatches('...Valid callback received...',
63                          self.browser.contents)
64        self.browser.open(self.manage_student_path)
65        self.browser.getControl(
66            name="transition").value = ['pay_first_school_fee']
67        self.browser.getControl("Save").click()
68        # Reset to returning
69        self.browser.getControl(name="transition").value = ['reset6']
70        self.browser.getControl("Save").click()
71        self.browser.open(self.payments_student_path + '/addop')
72        self.browser.getControl("Create ticket").click()
73        self.assertMatches('...This type of payment has already been made...',
74                           self.browser.contents)
75        # Remove all payments so that we can add a school fee payment again
76        for payment in self.student['payments'].keys():
77            del self.student['payments'][payment]
78        self.browser.open(self.payments_student_path + '/addop')
79        self.browser.getControl("Create ticket").click()
80        self.assertMatches('...ticket created...',
81                           self.browser.contents)
82        self.browser.open(self.payments_student_path + '/addop')
83        self.browser.getControl(name="form.p_category").value = ['gown']
84        self.browser.getControl("Create ticket").click()
85        self.browser.open(self.payments_student_path + '/addop')
86        self.browser.getControl(name="form.p_category").value = ['transfer']
87        self.browser.getControl("Create ticket").click()
88        self.browser.open(self.payments_student_path + '/addop')
89        self.browser.getControl(
90            name="form.p_category").value = ['bed_allocation']
91        self.browser.getControl("Create ticket").click()
92        self.browser.open(self.payments_student_path + '/addop')
93        self.browser.getControl(
94            name="form.p_category").value = ['hostel_maintenance']
95        self.browser.getControl("Create ticket").click()
96        self.browser.open(self.payments_student_path + '/addop')
97        self.browser.getControl(name="form.p_category").value = ['clearance']
98        self.browser.getControl("Create ticket").click()
99        self.certificate.study_mode = 'ug_pt'
100        self.browser.open(self.payments_student_path + '/addop')
101        self.browser.getControl(name="form.p_category").value = ['schoolfee']
102        self.browser.getControl("Create ticket").click()
103        self.assertMatches('...Amount could not be determined...',
104                           self.browser.contents)
105
106        # If the session configuration doesn't exist and error message will
107        # be shown
108        del self.app['configuration']['2004']
109        self.browser.open(self.payments_student_path)
110        self.browser.getControl("Add online payment ticket").click()
111        self.browser.getControl("Create ticket").click()
112        self.assertMatches('...Session configuration object is not...',
113                           self.browser.contents)
114
115
Note: See TracBrowser for help on using the repository browser.