3
# SchoolTool - common information systems platform for school administration
4
# Copyright (c) 2009 Shuttleworth Foundation
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
Unit tests for schooltool.intervention.generations.evolve6
27
from zope.app.testing import setup
28
from zope.component.hooks import setSite
29
from zope.interface import implements
30
from zope.site.folder import Folder
32
from schooltool.app.interfaces import ISchoolToolApplication
33
from schooltool.generations.tests import ContextStub
34
from schooltool.intervention.generations.evolve6 import evolve
37
class AppStub(Folder):
38
implements(ISchoolToolApplication)
41
def doctest_evolve6():
42
"""Evolution to generation 6.
44
First, we'll set up the app object:
46
>>> context = ContextStub()
47
>>> context.root_folder['app'] = app = AppStub()
48
>>> manager = setup.createSiteManager(app)
50
We'll set up our test with data that will be effected by running the
53
>>> app[u'schooltool.schoolyear'] = {'2009': ''}
54
>>> root = app[u'schooltool.interventions'] = {}
58
Finally, we'll run the evolve script, testing the effected values before and
61
>>> sorted(root.keys())
66
>>> sorted(root.keys())
69
What if the intervention container doesn't exist yet in the
72
>>> context = ContextStub()
73
>>> context.root_folder['app'] = app = AppStub()
74
>>> manager = setup.createSiteManager(app)
85
setup.placefulTearDown()
90
return unittest.TestSuite([
91
doctest.DocTestSuite(setUp=setUp, tearDown=tearDown,
92
optionflags=doctest.ELLIPSIS
93
| doctest.NORMALIZE_WHITESPACE
94
| doctest.REPORT_NDIFF
95
| doctest.REPORT_ONLY_FIRST_FAILURE),
98
if __name__ == '__main__':
99
unittest.main(defaultTest='test_suite')