summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-12-08 13:33:40 -0500
committerAdam Young <ayoung@redhat.com>2010-12-08 13:51:10 -0500
commit4c09809ea87f137bb8424743de4e6d7b62bb1254 (patch)
tree800d9c1520e0c1a5d902b939838fdafeff6d2c94 /tests
parent751ee81771aca741e6b79ddb97c0e1813d6ba047 (diff)
downloadfreeipa-4c09809ea87f137bb8424743de4e6d7b62bb1254.tar.gz
freeipa-4c09809ea87f137bb8424743de4e6d7b62bb1254.tar.xz
freeipa-4c09809ea87f137bb8424743de4e6d7b62bb1254.zip
Add plugin for manage self-service ACIs
This is just a thin wrapper around the aci plugin, controlling what types of ACIs can be added. Right now only ACIs in the basedn can be managed with this plugin. ticket 531
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_selfservice_plugin.py183
1 files changed, 183 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_selfservice_plugin.py b/tests/test_xmlrpc/test_selfservice_plugin.py
new file mode 100644
index 000000000..897bd0da4
--- /dev/null
+++ b/tests/test_xmlrpc/test_selfservice_plugin.py
@@ -0,0 +1,183 @@
+# Authors:
+# Rob Crittenden <rcritten@redhat.com>
+#
+# Copyright (C) 2010 Red Hat
+# see file 'COPYING' for use and warranty information
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; version 2 only
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+"""
+Test the `ipalib/plugins/selfservice.py` module.
+"""
+
+from ipalib import api, errors
+from tests.test_xmlrpc import objectclasses
+from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
+
+selfservice1 = u'testself'
+
+class test_selfservice(Declarative):
+
+ cleanup_commands = [
+ ('selfservice_del', [selfservice1], {}),
+ ]
+
+ tests = [
+
+ dict(
+ desc='Try to retrieve non-existent %r' % selfservice1,
+ command=('selfservice_show', [selfservice1], {}),
+ expected=errors.NotFound(reason='no such entry'),
+ ),
+
+
+ dict(
+ desc='Try to update non-existent %r' % selfservice1,
+ command=('selfservice_mod', [selfservice1], dict(description=u'Foo')),
+ expected=errors.NotFound(reason='no such entry'),
+ ),
+
+
+ dict(
+ desc='Try to delete non-existent %r' % selfservice1,
+ command=('selfservice_del', [selfservice1], {}),
+ expected=errors.NotFound(reason='no such entry'),
+ ),
+
+
+ dict(
+ desc='Search for non-existent %r' % selfservice1,
+ command=('selfservice_find', [selfservice1], {}),
+ expected=dict(
+ count=0,
+ truncated=False,
+ summary=u'0 selfservices matched',
+ result=[],
+ ),
+ ),
+
+
+ dict(
+ desc='Create %r' % selfservice1,
+ command=(
+ 'selfservice_add', [selfservice1], dict(
+ attrs=u'street,c,l,st,postalCode',
+ permissions=u'write',
+ )
+ ),
+ expected=dict(
+ value=selfservice1,
+ summary=u'Added selfservice "%s"' % selfservice1,
+ result=dict(
+ attrs=[u'street', u'c', u'l', u'st', u'postalCode'],
+ permissions=[u'write'],
+ selfaci=True,
+ aciname=selfservice1,
+ ),
+ ),
+ ),
+
+
+ dict(
+ desc='Try to create duplicate %r' % selfservice1,
+ command=(
+ 'selfservice_add', [selfservice1], dict(
+ attrs=u'street,c,l,st,postalCode',
+ permissions=u'write',
+ ),
+ ),
+ expected=errors.DuplicateEntry(),
+ ),
+
+
+ dict(
+ desc='Retrieve %r' % selfservice1,
+ command=('selfservice_show', [selfservice1], {}),
+ expected=dict(
+ value=selfservice1,
+ summary=None,
+ result={
+ 'attrs': [u'street', u'c', u'l', u'st', u'postalCode'],
+ 'permissions': [u'write'],
+ 'selfaci': True,
+ 'aciname': selfservice1,
+ },
+ ),
+ ),
+
+
+ dict(
+ desc='Search for %r' % selfservice1,
+ command=('selfservice_find', [selfservice1], {}),
+ expected=dict(
+ count=1,
+ truncated=False,
+ summary=u'1 selfservice matched',
+ result=[
+ {
+ 'attrs': [u'street', u'c', u'l', u'st', u'postalCode'],
+ 'permissions': [u'write'],
+ 'selfaci': True,
+ 'aciname': selfservice1,
+ },
+ ],
+ ),
+ ),
+
+
+ dict(
+ desc='Update %r' % selfservice1,
+ command=(
+ 'selfservice_mod', [selfservice1], dict(permissions=u'read')
+ ),
+ expected=dict(
+ value=selfservice1,
+ summary=u'Modified selfservice "%s"' % selfservice1,
+ result=dict(
+ attrs=[u'street', u'c', u'l', u'st', u'postalCode'],
+ permissions=[u'read'],
+ selfaci=True,
+ aciname=selfservice1,
+ ),
+ ),
+ ),
+
+
+ dict(
+ desc='Retrieve %r to verify update' % selfservice1,
+ command=('selfservice_show', [selfservice1], {}),
+ expected=dict(
+ value=selfservice1,
+ summary=None,
+ result={
+ 'attrs': [u'street', u'c', u'l', u'st', u'postalCode'],
+ 'permissions': [u'read'],
+ 'selfaci': True,
+ 'aciname': selfservice1,
+ },
+ ),
+ ),
+
+
+ dict(
+ desc='Delete %r' % selfservice1,
+ command=('selfservice_del', [selfservice1], {}),
+ expected=dict(
+ result=True,
+ value=selfservice1,
+ summary=u'Deleted selfservice "%s"' % selfservice1,
+ )
+ ),
+
+ ]