source: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py @ 17943

Last change on this file since 17943 was 15185, checked in by Henrik Bettermann, 6 years ago

Add MedicalLaboratoryRequestForm?.

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1## $Id: test_browser.py 15185 2018-10-12 15:51:59Z 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 os
19import shutil
20import tempfile
21from StringIO import StringIO
22from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo
23from mechanize import LinkNotFoundError
24from zope.securitypolicy.interfaces import IPrincipalRoleManager
25from zope.component.hooks import setSite, clearSite
26from zope.component import getUtility, createObject
27from zope.interface import verify
28from zope.event import notify
29from waeup.kofa.authentication import LocalRoleSetEvent
30from waeup.kofa.app import University
31from waeup.kofa.students.tests.test_browser import StudentsFullSetup
32from waeup.kofa.students.accommodation import BedTicket
33from waeup.kofa.testing import FunctionalTestCase
34from waeup.kofa.interfaces import (
35    IExtFileStore, IFileStoreNameChooser)
36from waeup.kofa.students.interfaces import IStudentsUtils
37from waeup.kofa.browser.tests.test_pdf import samples_dir
38from kofacustom.edopoly.testing import FunctionalLayer
39
40
41class StudentsContainerUITests(StudentsFullSetup):
42    # Tests for StudentsContainer class views and pages
43
44    layer = FunctionalLayer
45
46    def test_dummytest(self):
47        return
48
49class StudentUITests(StudentsFullSetup):
50    """Tests for customized student class views and pages
51    """
52
53    layer = FunctionalLayer
54
55    def setUp(self):
56        super(StudentUITests, self).setUp()
57
58
59    def test_medical_laboratory_form(self):
60        self.browser.open(self.login_path)
61        self.browser.getControl(name="form.login").value = self.student_id
62        self.browser.getControl(name="form.password").value = 'spwd'
63        self.browser.getControl("Login").click()
64        self.assertRaises(
65            LinkNotFoundError,
66            self.browser.getLink, 'Download medical laboratory request form')
67        # Add medical fee payment ticket
68        self.app['configuration']['2004'].medical = 180.0
69        payment = createObject('waeup.StudentOnlinePayment')
70        payment.p_category = u'medical'
71        payment.p_session = self.student.current_session
72        payment.p_id = u'anyid'
73        payment.p_state = u'paid'
74        self.student['payments']['anykey'] = payment
75        self.browser.open(self.student_path)
76        self.browser.getLink("Download medical laboratory request form").click()
77        self.assertEqual(self.browser.headers['Status'], '200 Ok')
78        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
79        path = os.path.join(samples_dir(), 'medical_laboratory_form.pdf')
80        open(path, 'wb').write(self.browser.contents)
81        print "Sample PDF medical_laboratory_form.pdf written to %s" % path
Note: See TracBrowser for help on using the repository browser.