## $Id: tests.py 7419 2011-12-21 07:59:29Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## from waeup.custom.testing import FunctionalLayer from waeup.sirp.students.tests.test_browser import StudentsFullSetup from waeup.custom.configuration import SessionConfiguration class StudentUITests(StudentsFullSetup): # Tests for customized student class views and pages layer = FunctionalLayer def test_manage_payments(self): # Add missing configuration data self.app['configuration']['2004'].gown_fee = 150 self.app['configuration']['2004'].transfer_fee = 90 self.app['configuration']['2004'].clearance_fee = 120 self.app['configuration']['2004'].maint_fee = 180 # Managers can add online payment tickets self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') self.browser.open(self.payments_student_path) self.browser.getControl("Add online payment ticket").click() self.browser.getControl("Create ticket").click() self.assertMatches('...Amount could not be determined...', self.browser.contents) self.browser.open(self.manage_student_path) self.browser.getControl(name="transition").value = ['admit'] self.browser.getControl("Save").click() self.browser.getControl(name="transition").value = ['start_clearance'] self.browser.getControl("Save").click() self.browser.getControl(name="transition").value = ['request_clearance'] self.browser.getControl("Save").click() self.browser.getControl(name="transition").value = ['clear'] self.browser.getControl("Save").click() self.browser.open(self.payments_student_path + '/addop') self.browser.getControl("Create ticket").click() self.assertMatches('...ticket created...', self.browser.contents) ctrl = self.browser.getControl(name='val_id') value = ctrl.options[0] self.browser.getLink(value).click() self.assertMatches('...Amount Authorized...', self.browser.contents) #payment_url = self.browser.url #self.browser.open(payment_url) self.browser.getLink("Request callback").click() self.assertMatches('...Valid callback received...', self.browser.contents) self.browser.open(self.manage_student_path) self.browser.getControl( name="transition").value = ['pay_first_school_fee'] self.browser.getControl("Save").click() # Reset to returning self.browser.getControl(name="transition").value = ['reset6'] self.browser.getControl("Save").click() self.browser.open(self.payments_student_path + '/addop') self.browser.getControl("Create ticket").click() self.assertMatches('...This type of payment has already been made...', self.browser.contents) # Remove all payments so that we can add a school fee payment again for payment in self.student['payments'].keys(): del self.student['payments'][payment] self.browser.open(self.payments_student_path + '/addop') self.browser.getControl("Create ticket").click() self.assertMatches('...ticket created...', self.browser.contents) self.browser.open(self.payments_student_path + '/addop') self.browser.getControl(name="form.p_category").value = ['gown'] self.browser.getControl("Create ticket").click() self.browser.open(self.payments_student_path + '/addop') self.browser.getControl(name="form.p_category").value = ['transfer'] self.browser.getControl("Create ticket").click() self.browser.open(self.payments_student_path + '/addop') self.browser.getControl( name="form.p_category").value = ['bed_allocation'] self.browser.getControl("Create ticket").click() self.browser.open(self.payments_student_path + '/addop') self.browser.getControl( name="form.p_category").value = ['hostel_maintenance'] self.browser.getControl("Create ticket").click() self.browser.open(self.payments_student_path + '/addop') self.browser.getControl(name="form.p_category").value = ['clearance'] self.browser.getControl("Create ticket").click() self.certificate.study_mode = 'ug_pt' self.browser.open(self.payments_student_path + '/addop') self.browser.getControl(name="form.p_category").value = ['schoolfee'] self.browser.getControl("Create ticket").click() self.assertMatches('...Amount could not be determined...', self.browser.contents) # If the session configuration doesn't exist and error message will # be shown del self.app['configuration']['2004'] self.browser.open(self.payments_student_path) self.browser.getControl("Add online payment ticket").click() self.browser.getControl("Create ticket").click() self.assertMatches('...Session configuration object is not...', self.browser.contents)