2
# Rob Crittenden <rcritten@redhat.com>
4
# Copyright (C) 2010 Red Hat
5
# see file 'COPYING' for use and warranty information
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
Test the `ipalib/plugins/selfservice.py` module.
24
from ipalib import api, errors
25
from tests.test_xmlrpc import objectclasses
26
from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
28
selfservice1 = u'testself'
30
class test_selfservice(Declarative):
33
('selfservice_del', [selfservice1], {}),
39
desc='Try to retrieve non-existent %r' % selfservice1,
40
command=('selfservice_show', [selfservice1], {}),
41
expected=errors.NotFound(reason='no such entry'),
46
desc='Try to update non-existent %r' % selfservice1,
47
command=('selfservice_mod', [selfservice1], dict(description=u'Foo')),
48
expected=errors.NotFound(reason='no such entry'),
53
desc='Try to delete non-existent %r' % selfservice1,
54
command=('selfservice_del', [selfservice1], {}),
55
expected=errors.NotFound(reason='no such entry'),
60
desc='Search for non-existent %r' % selfservice1,
61
command=('selfservice_find', [selfservice1], {}),
65
summary=u'0 selfservices matched',
71
# Note that we add postalCode but expect postalcode. This tests
72
# the attrs normalizer.
74
desc='Create %r' % selfservice1,
76
'selfservice_add', [selfservice1], dict(
77
attrs=u'street,c,l,st,postalCode',
83
summary=u'Added selfservice "%s"' % selfservice1,
85
attrs=[u'street', u'c', u'l', u'st', u'postalcode'],
86
permissions=[u'write'],
95
desc='Try to create duplicate %r' % selfservice1,
97
'selfservice_add', [selfservice1], dict(
98
attrs=u'street,c,l,st,postalCode',
102
expected=errors.DuplicateEntry(),
107
desc='Retrieve %r' % selfservice1,
108
command=('selfservice_show', [selfservice1], {}),
113
'attrs': [u'street', u'c', u'l', u'st', u'postalcode'],
114
'permissions': [u'write'],
116
'aciname': selfservice1,
123
desc='Search for %r' % selfservice1,
124
command=('selfservice_find', [selfservice1], {}),
128
summary=u'1 selfservice matched',
131
'attrs': [u'street', u'c', u'l', u'st', u'postalcode'],
132
'permissions': [u'write'],
134
'aciname': selfservice1,
142
desc='Update %r' % selfservice1,
144
'selfservice_mod', [selfservice1], dict(permissions=u'read')
148
summary=u'Modified selfservice "%s"' % selfservice1,
150
attrs=[u'street', u'c', u'l', u'st', u'postalcode'],
151
permissions=[u'read'],
153
aciname=selfservice1,
160
desc='Retrieve %r to verify update' % selfservice1,
161
command=('selfservice_show', [selfservice1], {}),
166
'attrs': [u'street', u'c', u'l', u'st', u'postalcode'],
167
'permissions': [u'read'],
169
'aciname': selfservice1,
176
desc='Delete %r' % selfservice1,
177
command=('selfservice_del', [selfservice1], {}),
181
summary=u'Deleted selfservice "%s"' % selfservice1,