24
24
from zope.app.testing import setup
25
from zope.component import provideAdapter
26
from zope.interface import implements
28
from schooltool.app.interfaces import ISchoolToolApplication
29
from schooltool.app.interfaces import IApplicationPreferences
27
32
def doctest_BasicPerson():
52
57
>>> verifyObject(IPersonFactory, factory)
55
>>> for column in factory.columns():
56
... print "%s, %s" % (column.name, column.title)
57
first_name, First Name
61
(('last_name', False),)
60
>>> class AppStub(object):
61
... implements(ISchoolToolApplication, IApplicationPreferences)
62
... def __init__(self):
63
... self.name_sorting = 'last_name'
65
>>> provideAdapter(lambda _: app,
66
... adapts=(None, ), provides=ISchoolToolApplication)
68
>>> for column in factory.columns():
69
... print "%s, %s" % (column.name, column.title)
71
first_name, First Name
74
(('last_name', False), ('first_name', False))
76
If we change name sorting order, both the sort and column order changes:
78
>>> app.name_sorting = 'first_name'
79
>>> for column in factory.columns():
80
... print "%s, %s" % (column.name, column.title)
81
first_name, First Name
85
(('first_name', False), ('last_name', False))
74
98
The title of the manager user is set to "Administratorius" + system name:
76
>>> manager = utility.createManagerUser("manager_username", "SchoolTool")
100
>>> manager = utility.createManagerUser("manager_username")
78
'Administrator, SchoolTool'
79
103
>>> manager.username
80
104
'manager_username'