source: main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py @ 9155

Last change on this file since 9155 was 9155, checked in by Henrik Bettermann, 12 years ago

Prepare for previous session payments but disable student payments completely. setPaymentDetails has to be written from the scratch.

  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1## $Id: test_browser.py 9155 2012-09-04 07:09: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##
18import os
19import shutil
20import tempfile
21from StringIO import StringIO
22from hurry.workflow.interfaces import IWorkflowState
23from zope.component.hooks import setSite, clearSite
24from zope.component import getUtility, createObject
25from zope.interface import verify
26from waeup.kofa.app import University
27from waeup.kofa.students.tests.test_browser import StudentsFullSetup
28from waeup.kofa.testing import FunctionalTestCase
29from waeup.kofa.interfaces import (
30    IExtFileStore, IFileStoreNameChooser)
31from waeup.kofa.students.interfaces import IStudentsUtils
32from waeup.futminna.testing import FunctionalLayer
33
34
35class StudentProcessorTest(FunctionalTestCase):
36    """Perform some batching tests.
37    """
38
39    layer = FunctionalLayer
40
41    def setUp(self):
42        super(StudentProcessorTest, self).setUp()
43        # Setup a sample site for each test
44        app = University()
45        self.dc_root = tempfile.mkdtemp()
46        app['datacenter'].setStoragePath(self.dc_root)
47
48        # Prepopulate the ZODB...
49        self.getRootFolder()['app'] = app
50        # we add the site immediately after creation to the
51        # ZODB. Catalogs and other local utilities are not setup
52        # before that step.
53        self.app = self.getRootFolder()['app']
54        # Set site here. Some of the following setup code might need
55        # to access grok.getSite() and should get our new app then
56        setSite(app)
57
58
59    def tearDown(self):
60        super(StudentProcessorTest, self).tearDown()
61        shutil.rmtree(self.workdir)
62        shutil.rmtree(self.dc_root)
63        clearSite()
64        return
65
66class StudentUITests(StudentsFullSetup):
67    """Tests for customized student class views and pages
68    """
69
70    layer = FunctionalLayer
71
72    def test_get_returning_data(self):
73        # Student is in level 100, session 2004 with verdict A
74        utils = getUtility(IStudentsUtils)
75        self.assertEqual(utils.getReturningData(self.student),(2005, 200))
76        self.student['studycourse'].current_verdict = 'C'
77        self.assertEqual(utils.getReturningData(self.student),(2005, 110))
78        self.student['studycourse'].current_verdict = 'D'
79        self.assertEqual(utils.getReturningData(self.student),(2005, 100))
80        return
Note: See TracBrowser for help on using the repository browser.