summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-12-11 17:37:47 -0500
committerJason Gerard DeRose <jderose@redhat.com>2009-12-14 20:02:33 -0700
commitc334ec45849100b454bf775ba2ecaa05c6106546 (patch)
tree0bb9cc4ef85a7b98c4a2acf6d6e250b705628ab6 /tests
parent2b8cae8a9128d763ff2e6b6b918878677ffa9964 (diff)
downloadfreeipa-c334ec45849100b454bf775ba2ecaa05c6106546.tar.gz
freeipa-c334ec45849100b454bf775ba2ecaa05c6106546.tar.xz
freeipa-c334ec45849100b454bf775ba2ecaa05c6106546.zip
Add simple tests for the aci plugin
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_aci_plugin.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_aci_plugin.py b/tests/test_xmlrpc/test_aci_plugin.py
new file mode 100644
index 00000000..c42f1abd
--- /dev/null
+++ b/tests/test_xmlrpc/test_aci_plugin.py
@@ -0,0 +1,77 @@
+# Authors:
+# Rob Crittenden <rcritten@redhat.com>
+#
+# Copyright (C) 2009 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/aci.py` module.
+"""
+
+import sys
+from xmlrpc_test import XMLRPC_test, assert_attr_equal
+from ipalib import api
+from ipalib import errors
+
+
+class test_aci(XMLRPC_test):
+ """
+ Test the `aci` plugin.
+ """
+ aciname = u'acitest'
+ taskgroup = u'testtaskgroup'
+ kw = {'permissions': u'add', 'type': u'user', 'taskgroup': taskgroup }
+ aci = u'(target = "ldap:///uid=*,cn=users,cn=accounts,%s")(version 3.0;acl "acitest";allow (add) groupdn = "ldap:///cn=testtaskgroup,cn=taskgroups,cn=accounts,%s";)' % (api.env.basedn, api.env.basedn)
+
+ def test_1_aci_add(self):
+ """
+ Test adding an aci using the `xmlrpc.aci_add` method.
+ """
+ result = api.Command['aci_add'](self.aciname, **self.kw)['result']
+
+ assert result == self.aci
+
+ def test_2_aci_show(self):
+ """
+ Test showing an aci using the `xmlrpc.aci_show` method.
+ """
+ result = api.Command['aci_show'](self.aciname)['result']
+
+ assert result == self.aci
+
+ def test_3_aci_find(self):
+ """
+ Test showing an aci using the `xmlrpc.aci_show` method.
+ """
+ outcome = api.Command['aci_find'](self.aciname)
+ result = outcome['result']
+ count = outcome['count']
+
+ assert count == 1
+ assert result[0] == self.aci
+
+ def test_4_aci_del(self):
+ """
+ Remove the second test policy with `xmlrpc.aci_del`.
+ """
+ assert api.Command['aci_del'](self.aciname)['result'] is True
+
+ # Verify that it is gone
+ try:
+ api.Command['aci_show'](self.aciname)
+ except errors.NotFound:
+ pass
+ else:
+ assert False