diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-09-16 09:35:48 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-09-22 15:41:19 +0200 |
commit | a1430dcb2c8e63e3077d00878431c0698944a07d (patch) | |
tree | 7843a84ec320eeff7e6951e5eebf9765b76bc11d /tests | |
parent | 37836a2e6c07550d504a1075ea5626f160f13342 (diff) | |
download | freeipa-a1430dcb2c8e63e3077d00878431c0698944a07d.tar.gz freeipa-a1430dcb2c8e63e3077d00878431c0698944a07d.tar.xz freeipa-a1430dcb2c8e63e3077d00878431c0698944a07d.zip |
Normalize uid in user principal to lower-case and do validation
Use same normalization and validation in passwd plugin and add some
tests for invalid principals
https://fedorahosted.org/freeipa/ticket/1778
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_hbactest_plugin.py | 4 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_user_plugin.py | 62 |
2 files changed, 63 insertions, 3 deletions
diff --git a/tests/test_xmlrpc/test_hbactest_plugin.py b/tests/test_xmlrpc/test_hbactest_plugin.py index 37e3ad80a..7e4607c85 100644 --- a/tests/test_xmlrpc/test_hbactest_plugin.py +++ b/tests/test_xmlrpc/test_hbactest_plugin.py @@ -42,9 +42,9 @@ class test_hbactest(XMLRPC_test): test_user = u'hbacrule_test_user' test_group = u'hbacrule_test_group' - test_host = u'hbacrule._test_host' + test_host = u'hbacrule.test-host' test_hostgroup = u'hbacrule_test_hostgroup' - test_sourcehost = u'hbacrule._test_src_host' + test_sourcehost = u'hbacrule.test-src-host' test_sourcehostgroup = u'hbacrule_test_src_hostgroup' test_service = u'ssh' diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py index 9392742e9..7a2489ee8 100644 --- a/tests/test_xmlrpc/test_user_plugin.py +++ b/tests/test_xmlrpc/test_user_plugin.py @@ -466,7 +466,6 @@ class test_user(Declarative): ), - dict( desc='Create %r' % user1, command=( @@ -704,4 +703,65 @@ class test_user(Declarative): ), + dict( + desc='Create user %r with upper-case principal' % user1, + command=( + 'user_add', [user1], dict(givenname=u'Test', sn=u'User1', + krbprincipalname=user1.upper()) + ), + expected=dict( + value=user1, + summary=u'Added user "tuser1"', + result=dict( + gecos=[u'Test User1'], + givenname=[u'Test'], + homedirectory=[u'/home/tuser1'], + krbprincipalname=[u'tuser1@' + api.env.realm], + loginshell=[u'/bin/sh'], + objectclass=objectclasses.user, + sn=[u'User1'], + uid=[user1], + uidnumber=[fuzzy_digits], + gidnumber=[fuzzy_digits], + displayname=[u'Test User1'], + cn=[u'Test User1'], + initials=[u'TU'], + ipauniqueid=[fuzzy_uuid], + krbpwdpolicyreference=lambda x: [DN(i) for i in x] == \ + [DN(('cn','global_policy'),('cn',api.env.realm), + ('cn','kerberos'),api.env.basedn)], + mepmanagedentry=lambda x: [DN(i) for i in x] == \ + [DN(('cn',user1),('cn','groups'),('cn','accounts'), + api.env.basedn)], + memberof_group=[u'ipausers'], + has_keytab=False, + has_password=False, + dn=lambda x: DN(x) == \ + DN(('uid','tuser1'),('cn','users'),('cn','accounts'), + api.env.basedn), + ), + ), + ), + + + dict( + desc='Create user %r with bad realm in principal' % user1, + command=( + 'user_add', [user1], dict(givenname=u'Test', sn=u'User1', + krbprincipalname='%s@NOTFOUND.ORG' % user1) + ), + expected=errors.RealmMismatch() + ), + + + dict( + desc='Create user %r with malformed principal' % user1, + command=( + 'user_add', [user1], dict(givenname=u'Test', sn=u'User1', + krbprincipalname='%s@BAD@NOTFOUND.ORG' % user1) + ), + expected=errors.MalformedUserPrincipal(principal='%s@BAD@NOTFOUND.ORG' % user1), + ), + + ] |