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.evolve5
27
from zope.app.testing import setup
28
from zope.catalog.interfaces import ICatalog
29
from zope.component import queryUtility, provideUtility
30
from zope.component.hooks import getSite, setSite
31
from zope.interface import implements
32
from zope.intid import IntIds
33
from zope.intid.interfaces import IIntIds
34
from zope.site.folder import Folder
36
from schooltool.app.interfaces import ISchoolToolApplication
37
from schooltool.generations.tests import ContextStub
38
from schooltool.intervention.generations.evolve5 import evolve
41
class AppStub(Folder):
42
implements(ISchoolToolApplication)
45
def doctest_evolve5():
46
"""Evolution to generation 5.
50
>>> provideUtility(IntIds(), IIntIds)
54
>>> context = ContextStub()
55
>>> context.root_folder['app'] = app = AppStub()
56
>>> manager = setup.createSiteManager(app)
62
Site was restored after evolution.
67
Contact catalog was registered for ISchoolToolApplication sites.
69
>>> catalog = queryUtility(ICatalog, 'schooltool.intervention')
75
>>> catalog = queryUtility(ICatalog, 'schooltool.intervention')
77
<zc.catalog.extentcatalog.Catalog object ...>
79
Catalog indexes were set up properly.
81
>>> sorted(i.__name__ for i in catalog.values())
82
[u'created', u'first_name', u'intervention_type', u'last_name',
83
u'persons_responsible', u'schoolYearId']
93
setup.placefulTearDown()
98
return unittest.TestSuite([
99
doctest.DocTestSuite(setUp=setUp, tearDown=tearDown,
100
optionflags=doctest.ELLIPSIS
101
| doctest.NORMALIZE_WHITESPACE
102
| doctest.REPORT_NDIFF
103
| doctest.REPORT_ONLY_FIRST_FAILURE),
106
if __name__ == '__main__':
107
unittest.main(defaultTest='test_suite')