source: main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_browser.py @ 17563

Last change on this file since 17563 was 17563, checked in by Henrik Bettermann, 15 months ago

Download ExaminationClearanceSlip? als in state paid.

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1## $Id: test_browser.py 17563 2023-08-28 20:36:08Z 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.browser.tests.test_pdf import samples_dir
37from waeup.kofa.students.interfaces import IStudentsUtils
38from kofacustom.unidel.testing import FunctionalLayer
39
40
41class StudentsContainerUITests(StudentsFullSetup):
42    # Tests for StudentsContainer class views and pages
43
44    layer = FunctionalLayer
45
46    def test_student_examclearance_slip(self):
47        self.certificate.study_mode = 'ug_ft'
48        # Student cant login if their password is not set
49        IWorkflowState(self.student).setState('courses registered')
50        self.browser.open(self.login_path)
51        self.browser.getControl(name="form.login").value = self.student_id
52        self.browser.getControl(name="form.password").value = 'spwd'
53        self.browser.getControl("Login").click()
54        self.assertMatches(
55            '...You logged in...', self.browser.contents)
56        self.browser.getLink("Base Data").click()
57        self.assertRaises(
58            LinkNotFoundError,
59            self.browser.getLink, 'Download examination clearance slip')
60        #self.browser.getLink("Download examination clearance slip").click()
61        # Unidel changed it's mind
62        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
63        self.browser.getLink("Base Data").click()
64        self.browser.getLink("Download examination clearance slip").click()
65        self.assertEqual(self.browser.headers['Status'], '200 Ok')
66        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
67        path = os.path.join(samples_dir(), 'examclearance_slip.pdf')
68        open(path, 'wb').write(self.browser.contents)
69        print "Sample exampclearance_slip.pdf written to %s" % path
Note: See TracBrowser for help on using the repository browser.