summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-01-27 12:17:10 +0100
committerRob Crittenden <rcritten@redhat.com>2011-01-28 23:51:09 -0500
commitf72d8e506a82dc558f89a4d115f3aad261655ba8 (patch)
tree676df4d990e6997944cad60bac694598b4692b5e /tests
parent359d54e741877f04b0773fb0955041eee7ec0054 (diff)
downloadfreeipa.git-f72d8e506a82dc558f89a4d115f3aad261655ba8.tar.gz
freeipa.git-f72d8e506a82dc558f89a4d115f3aad261655ba8.tar.xz
freeipa.git-f72d8e506a82dc558f89a4d115f3aad261655ba8.zip
ipa permission-mod --rename does not work
This patch fixes nonfunctional rename operation in permission plugin. Also makes sure, that no change is made to the underlying ACI in pre_callback() when the target permission already exists. Several tests for the rename operation have been created to ensure that the it won't break again unnoticed. https://fedorahosted.org/freeipa/ticket/814
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_permission_plugin.py68
1 files changed, 64 insertions, 4 deletions
diff --git a/tests/test_xmlrpc/test_permission_plugin.py b/tests/test_xmlrpc/test_permission_plugin.py
index 9d066cc8..15f9c270 100644
--- a/tests/test_xmlrpc/test_permission_plugin.py
+++ b/tests/test_xmlrpc/test_permission_plugin.py
@@ -32,6 +32,12 @@ permission1_dn = u'cn=%s,%s,%s' % (permission1,
)
+permission1_renamed = u'testperm1_rn'
+permission1_renamed_dn = u'cn=%s,%s,%s' % (permission1_renamed,
+ api.env.container_permission,api.env.basedn,
+)
+
+
permission2 = u'testperm2'
permission2_dn = u'cn=%s,%s,%s' % (permission2,
api.env.container_permission,api.env.basedn,
@@ -332,13 +338,67 @@ class test_permission(Declarative):
),
+
dict(
- desc='Delete %r' % permission1,
- command=('permission_del', [permission1], {}),
+ desc='Try to rename %r to existing permission %r' % (permission1,
+ permission2),
+ command=(
+ 'permission_mod', [permission1], dict(rename=permission2,
+ description=u"Renamed Desc",
+ permissions=u'read',)
+ ),
+ expected=errors.DuplicateEntry(),
+ ),
+
+
+ dict(
+ desc='Check integrity of original permission %r' % permission1,
+ command=('permission_show', [permission1], {}),
expected=dict(
- result=dict(failed=u''),
value=permission1,
- summary=u'Deleted permission "%s"' % permission1,
+ summary=None,
+ result={
+ 'dn': permission1_dn,
+ 'cn': [permission1],
+ 'description': [u'New desc 1'],
+ 'member_privilege': [privilege1],
+ 'type': u'user',
+ 'permissions': [u'write'],
+ },
+ ),
+ ),
+
+
+ dict(
+ desc='Rename %r to permission %r' % (permission1,
+ permission1_renamed),
+ command=(
+ 'permission_mod', [permission1], dict(rename=permission1_renamed,
+ description=u"Renamed Desc",
+ permissions= u'read',)
+ ),
+ expected=dict(
+ value=permission1,
+ summary=u'Modified permission "%s"' % permission1,
+ result={
+ 'dn': permission1_renamed_dn,
+ 'cn': [permission1_renamed],
+ 'description': [u'Renamed Desc'],
+ 'member_privilege': [privilege1],
+ 'type': u'user',
+ 'permissions': [u'read'],
+ },
+ ),
+ ),
+
+
+ dict(
+ desc='Delete %r' % permission1_renamed,
+ command=('permission_del', [permission1_renamed], {}),
+ expected=dict(
+ result=dict(failed=u''),
+ value=permission1_renamed,
+ summary=u'Deleted permission "%s"' % permission1_renamed,
)
),