diff options
author | Petr Viktorin <pviktori@redhat.com> | 2014-05-27 12:21:33 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-05-28 15:58:24 +0200 |
commit | 8bbd52e347f3e6395d469528e1220fd9158e5609 (patch) | |
tree | b9f8362d643633c0a8f60c1f7abce20bd2b01c0b /ipatests/test_xmlrpc | |
parent | 8b7daf675e77d7a5e2de6eadb26ca3b682c0d67f (diff) | |
download | freeipa-8bbd52e347f3e6395d469528e1220fd9158e5609.tar.gz freeipa-8bbd52e347f3e6395d469528e1220fd9158e5609.tar.xz freeipa-8bbd52e347f3e6395d469528e1220fd9158e5609.zip |
pwpolicy-mod: Fix crash when priority is changed
The exc_callback was expecting the old update_entry signature,
(dn, attrs). This was changed to just (entry) for ticket #2660,
see http://www.freeipa.org/page/HowTo/Migrate_your_code_to_the_new_LDAP_API.
Update the exc_callback to expect the entry as first argument,
and add some tests.
https://fedorahosted.org/freeipa/ticket/4309
Reviewed-By: Martin Kosek <mkosek@redhat.com>
Diffstat (limited to 'ipatests/test_xmlrpc')
-rw-r--r-- | ipatests/test_xmlrpc/objectclasses.py | 6 | ||||
-rw-r--r-- | ipatests/test_xmlrpc/test_pwpolicy_plugin.py | 72 |
2 files changed, 76 insertions, 2 deletions
diff --git a/ipatests/test_xmlrpc/objectclasses.py b/ipatests/test_xmlrpc/objectclasses.py index 363e1c7c3..ff497c81e 100644 --- a/ipatests/test_xmlrpc/objectclasses.py +++ b/ipatests/test_xmlrpc/objectclasses.py @@ -170,3 +170,9 @@ radiusproxy = [ u'ipatokenradiusconfiguration', u'top', ] + +pwpolicy = [ + u'krbpwdpolicy', + u'nscontainer', + u'top', +] diff --git a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py index 3b482ce2d..5a8ac1030 100644 --- a/ipatests/test_xmlrpc/test_pwpolicy_plugin.py +++ b/ipatests/test_xmlrpc/test_pwpolicy_plugin.py @@ -21,12 +21,14 @@ Test the `ipalib/plugins/pwpolicy.py` module. """ -import sys from nose.tools import assert_raises # pylint: disable=E0611 -from xmlrpc_test import XMLRPC_test, assert_attr_equal from ipalib import api from ipalib import errors +from ipapython.dn import DN +from ipatests.test_xmlrpc import objectclasses +from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, assert_attr_equal, + Declarative) class test_pwpolicy(XMLRPC_test): @@ -242,3 +244,69 @@ class test_pwpolicy(XMLRPC_test): # Remove the user we created api.Command['user_del'](self.user) + + +class test_pwpolicy_mod_cospriority(Declarative): + """Tests for cospriority modifications""" + cleanup_commands = [ + ('pwpolicy_del', [u'ipausers'], {}), + ] + + tests = [ + dict( + desc='Create a password policy', + command=('pwpolicy_add', [u'ipausers'], dict( + krbmaxpwdlife=90, + krbminpwdlife=1, + krbpwdhistorylength=10, + krbpwdmindiffchars=3, + krbpwdminlength=8, + cospriority=10, + )), + expected=dict( + result=dict( + cn=[u'ipausers'], + cospriority=[u'10'], + dn=DN('cn=ipausers', ('cn', api.env.realm), + 'cn=kerberos', api.env.basedn), + krbmaxpwdlife=[u'90'], + krbminpwdlife=[u'1'], + krbpwdhistorylength=[u'10'], + krbpwdmindiffchars=[u'3'], + krbpwdminlength=[u'8'], + objectclass=objectclasses.pwpolicy, + ), + summary=None, + value=u'ipausers', + ), + ), + + dict( + # https://fedorahosted.org/freeipa/ticket/4309 + desc="Try no-op modification of password policy's cospriority", + command=('pwpolicy_mod', [u'ipausers'], dict( + cospriority=10, + )), + expected=errors.EmptyModlist(), + ), + + dict( + desc="Modify the password policy's cospriority", + command=('pwpolicy_mod', [u'ipausers'], dict( + cospriority=20, + )), + expected=dict( + result=dict( + cn=[u'ipausers'], + cospriority=[u'20'], + krbmaxpwdlife=[u'90'], + krbminpwdlife=[u'1'], + krbpwdhistorylength=[u'10'], + krbpwdmindiffchars=[u'3'], + krbpwdminlength=[u'8'], + ), + summary=None, + value=u'ipausers', + ), + ), + ] |