source: main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/university/tests.py @ 13628

Last change on this file since 13628 was 13539, checked in by Henrik Bettermann, 9 years ago

We do not need to export next_matric_dict any longer.

  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[12905]1## $Id: tests.py 13539 2015-12-11 09:06:02Z henrik $
2##
3## Copyright (C) 2015 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##
18
19import tempfile
20import os
[12907]21from hurry.workflow.interfaces import IWorkflowState
[12905]22from zope.component import getUtility
23from waeup.kofa.students.tests.test_browser import StudentsFullSetup
24from waeup.kofa.students.interfaces import IStudentsUtils
25from waeup.kwarapoly.testing import FunctionalLayer
26from waeup.kwarapoly.university.export import CustomDepartmentExporter
27
28class DepartmentExporterTest(StudentsFullSetup):
29
30    layer = FunctionalLayer
31
32    def test_export_all(self):
33        self.workdir = tempfile.mkdtemp()
34        self.outfile = os.path.join(self.workdir, 'myoutput.csv')
35        utils = getUtility(IStudentsUtils)
36        self.student.matric_number = None
[12911]37        self.student['studycourse'].entry_session = 2015
[12907]38        IWorkflowState(self.student).setState('school fee paid')
[12905]39        msg, mnumber = utils.setMatricNumber(self.student)
40        self.assertEqual(msg, 'Matriculation number cannot be set.')
41        self.assertEqual(mnumber, None)
42        self.student['studycourse'].entry_mode = 'nd_ft'
43        msg, mnumber = utils.setMatricNumber(self.student)
44        exporter = CustomDepartmentExporter()
45        exporter.export_all(self.app, self.outfile)
46        result = open(self.outfile, 'rb').read()
47        self.assertEqual(
48            result,
[13539]49            'code,faculty_code,title,title_prefix,users_with_local_roles\r\n'
50            'dep1,fac1,Unnamed Department,department,[]\r\n'
[12905]51            )
52        return
53
Note: See TracBrowser for help on using the repository browser.