source: main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py @ 12370

Last change on this file since 12370 was 11755, checked in by Henrik Bettermann, 10 years ago

Customize payment_slip_download_warning. Application payment tickets can be downloaded without submitting the form.

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1## $Id: test_browser.py 11755 2014-07-09 05:43:16Z 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##
18import grok
19from zope.event import notify
20from zope.component import createObject, getUtility
21from waeup.kofa.configuration import SessionConfiguration
22from waeup.aaue.testing import FunctionalLayer
23from waeup.kofa.applicants.tests.test_browser import (
24    ApplicantsFullSetup, container_name_1, session_1)
25
26class CustomApplicantUITest(ApplicantsFullSetup):
27    """Perform some browser tests.
28    """
29
30    layer = FunctionalLayer
31
32    def test_show_credentials_on_landing_page(self):
33        # An applicant can register himself.
34        self.applicant.reg_number = u'1234'
35        notify(grok.ObjectModifiedEvent(self.applicant))
36        self.browser.open('http://localhost/app/applicants/%s/' % container_name_1)
37        self.browser.getLink("Register for application").click()
38        # Fill the edit form with suitable values
39        self.browser.getControl(name="form.firstname").value = 'Klaus'
40        self.browser.getControl(name="form.lastname").value = 'Lutz'
41        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
42        self.browser.getControl("Send login credentials").click()
43        self.assertMatches('...Your registration was successful...',
44            self.browser.contents)
45        self.assertTrue('<td>Password:</td>' in self.browser.contents)
46        return
47
48    def test_payment_slip_download_warning(self):
49        configuration = SessionConfiguration()
50        configuration.academic_session = session_1
51        configuration.application_fee = 200.0
52        self.app['configuration'].addSessionConfiguration(configuration)
53        self.login()
54        self.browser.open(self.edit_path)
55        self.fill_correct_values()
56        self.browser.getControl(name="form.programme_type").value = ['regular']
57        self.browser.getControl(name="form.nationality").value = ['NG']
58        self.browser.getControl("Save").click()
59        self.browser.getControl("Add online payment ticket").click()
60        self.assertMatches('...Payment ticket created...',
61                           self.browser.contents)
62        # Payment tickets can be downloaded without submitting the form.
63        self.browser.getLink("Download payment slip").click()
64        self.assertEqual(self.browser.headers['Content-Type'],
65                 'application/pdf')
66        return
Note: See TracBrowser for help on using the repository browser.