diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-04-27 07:15:56 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-05-07 17:21:58 +0200 |
commit | 0206dbe79502dd06b9c44622ead4635e430e3620 (patch) | |
tree | ce241048b05e5d385c51c2b0218adf9aa7253fe7 /tests | |
parent | c45174d68009076781431ad13a51bd454f6e3ce8 (diff) | |
download | freeipa-0206dbe79502dd06b9c44622ead4635e430e3620.tar.gz freeipa-0206dbe79502dd06b9c44622ead4635e430e3620.tar.xz freeipa-0206dbe79502dd06b9c44622ead4635e430e3620.zip |
Do not crash on empty reverse member options
Calling a LDAP{Add,Remove}ReverseMember with an empty reverse_member
caused an internal error, because empty values are converted to None,
which is then iterated.
Use an empty list instead of None (or other false falues, of which we
only use the empty list).
https://fedorahosted.org/freeipa/ticket/2681
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_privilege_plugin.py | 44 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_role_plugin.py | 42 |
2 files changed, 86 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_privilege_plugin.py b/tests/test_xmlrpc/test_privilege_plugin.py index eb812068..d8d9b22a 100644 --- a/tests/test_xmlrpc/test_privilege_plugin.py +++ b/tests/test_xmlrpc/test_privilege_plugin.py @@ -348,6 +348,50 @@ class test_privilege(Declarative): dict( + desc='Add zero permissions to %r' % privilege1, + command=('privilege_add_permission', [privilege1], + dict(permission=None), + ), + expected=dict( + completed=0, + failed=dict( + member=dict( + permission=[], + ), + ), + result={ + 'dn': lambda x: DN(x) == privilege1_dn, + 'cn': [privilege1], + 'description': [u'New desc 1'], + 'memberof_permission': [permission2], + } + ), + ), + + + dict( + desc='Remove zero permissions from %r' % privilege1, + command=('privilege_remove_permission', [privilege1], + dict(permission=None), + ), + expected=dict( + completed=0, + failed=dict( + member=dict( + permission=[], + ), + ), + result={ + 'dn': lambda x: DN(x) == privilege1_dn, + 'cn': [privilege1], + 'description': [u'New desc 1'], + 'memberof_permission': [permission2], + } + ), + ), + + + dict( desc='Delete %r' % privilege1, command=('privilege_del', [privilege1], {}), expected=dict( diff --git a/tests/test_xmlrpc/test_role_plugin.py b/tests/test_xmlrpc/test_role_plugin.py index 62bc6ead..e2bd28cd 100644 --- a/tests/test_xmlrpc/test_role_plugin.py +++ b/tests/test_xmlrpc/test_role_plugin.py @@ -202,6 +202,48 @@ class test_role(Declarative): dict( + desc='Add zero privileges to role %r' % role1, + command=('role_add_privilege', [role1], dict(privilege=None) + ), + expected=dict( + completed=0, + failed=dict( + member=dict( + privilege=[], + ), + ), + result={ + 'dn': lambda x: DN(x) == role1_dn, + 'cn': [role1], + 'description': [u'role desc 1'], + 'memberof_privilege': [privilege1], + } + ), + ), + + + dict( + desc='Remove zero privileges from role %r' % role1, + command=('role_remove_privilege', [role1], dict(privilege=None) + ), + expected=dict( + completed=0, + failed=dict( + member=dict( + privilege=[], + ), + ), + result={ + 'dn': lambda x: DN(x) == role1_dn, + 'cn': [role1], + 'description': [u'role desc 1'], + 'memberof_privilege': [privilege1], + } + ), + ), + + + dict( desc='Add member %r to %r' % (group1, role1), command=('role_add_member', [role1], dict(group=group1)), expected=dict( |