diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_attr.py | 126 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_group_plugin.py | 4 |
2 files changed, 128 insertions, 2 deletions
diff --git a/tests/test_xmlrpc/test_attr.py b/tests/test_xmlrpc/test_attr.py index 11aaa01e3..ef239709d 100644 --- a/tests/test_xmlrpc/test_attr.py +++ b/tests/test_xmlrpc/test_attr.py @@ -210,6 +210,128 @@ class test_attr(Declarative): dict( + desc='Delete one phone number for %r' % user1, + command=( + 'user_mod', [user1], dict(delattr=u'telephoneNumber=301-555-1212') + ), + expected=dict( + result=dict( + givenname=[u'Finkle'], + homedirectory=[u'/home/tuser1'], + loginshell=[u'/bin/sh'], + sn=[u'User1'], + uid=[user1], + uidnumber=[fuzzy_digits], + gidnumber=[fuzzy_digits], + mail=[u'test@example.com', u'test2@example.com'], + memberof_group=[u'ipausers'], + telephonenumber=[u'202-888-9833', u'703-555-1212'], + nsaccountlock=False, + has_keytab=False, + has_password=False, + ), + summary=u'Modified user "tuser1"', + value=user1, + ), + ), + + + dict( + desc='Try deleting the number again for %r' % user1, + command=( + 'user_mod', [user1], dict(delattr=u'telephoneNumber=301-555-1212') + ), + expected=errors.AttrValueNotFound(attr='telephoneNumber', value='301-555-1212') + ), + + + dict( + desc='Add and delete one phone number for %r' % user1, + command=( + 'user_mod', [user1], dict(addattr=u'telephoneNumber=301-555-1212', + delattr=u'telephoneNumber=202-888-9833') + ), + expected=dict( + result=dict( + givenname=[u'Finkle'], + homedirectory=[u'/home/tuser1'], + loginshell=[u'/bin/sh'], + sn=[u'User1'], + uid=[user1], + uidnumber=[fuzzy_digits], + gidnumber=[fuzzy_digits], + mail=[u'test@example.com', u'test2@example.com'], + memberof_group=[u'ipausers'], + telephonenumber=[u'301-555-1212', u'703-555-1212'], + nsaccountlock=False, + has_keytab=False, + has_password=False, + ), + summary=u'Modified user "tuser1"', + value=user1, + ), + ), + + + dict( + desc='Add and delete the same phone number for %r' % user1, + command=( + 'user_mod', [user1], dict(addattr=(u'telephoneNumber=301-555-1212', + u'telephoneNumber=202-888-9833'), + delattr=u'telephoneNumber=301-555-1212') + ), + expected=dict( + result=dict( + givenname=[u'Finkle'], + homedirectory=[u'/home/tuser1'], + loginshell=[u'/bin/sh'], + sn=[u'User1'], + uid=[user1], + uidnumber=[fuzzy_digits], + gidnumber=[fuzzy_digits], + mail=[u'test@example.com', u'test2@example.com'], + memberof_group=[u'ipausers'], + telephonenumber=[u'703-555-1212', u'301-555-1212', u'202-888-9833'], + nsaccountlock=False, + has_keytab=False, + has_password=False, + ), + summary=u'Modified user "tuser1"', + value=user1, + ), + ), + + + dict( + desc='Set and delete the a phone number for %r' % user1, + command=( + 'user_mod', [user1], dict(setattr=(u'telephoneNumber=301-555-1212', + u'telephoneNumber=202-888-9833'), + delattr=u'telephoneNumber=301-555-1212') + ), + expected=dict( + result=dict( + givenname=[u'Finkle'], + homedirectory=[u'/home/tuser1'], + loginshell=[u'/bin/sh'], + sn=[u'User1'], + uid=[user1], + uidnumber=[fuzzy_digits], + gidnumber=[fuzzy_digits], + mail=[u'test@example.com', u'test2@example.com'], + memberof_group=[u'ipausers'], + telephonenumber=[u'202-888-9833'], + nsaccountlock=False, + has_keytab=False, + has_password=False, + ), + summary=u'Modified user "tuser1"', + value=user1, + ), + ), + + + dict( desc='Try setting givenname to None with setattr in %r' % user1, command=( 'user_mod', [user1], dict(setattr=(u'givenname=')) @@ -243,7 +365,7 @@ class test_attr(Declarative): gidnumber=[fuzzy_digits], mail=[u'test@example.com', u'test2@example.com'], memberof_group=[u'ipausers'], - telephonenumber=[u'301-555-1212', u'202-888-9833', u'703-555-1212'], + telephonenumber=[u'202-888-9833'], nsaccountlock=False, has_keytab=False, has_password=False, @@ -270,7 +392,7 @@ class test_attr(Declarative): gidnumber=[fuzzy_digits], mail=[u'test@example.com', u'test2@example.com'], memberof_group=[u'ipausers'], - telephonenumber=[u'301-555-1212', u'202-888-9833', u'703-555-1212'], + telephonenumber=[u'202-888-9833'], nsaccountlock=False, has_keytab=False, has_password=False, diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py index 6403251e6..86c0d90da 100644 --- a/tests/test_xmlrpc/test_group_plugin.py +++ b/tests/test_xmlrpc/test_group_plugin.py @@ -755,6 +755,10 @@ class test_group(Declarative): dn=lambda x: DN(x) == \ DN(('uid','tuser1'),('cn','users'),('cn','accounts'), api.env.basedn), + krbpwdpolicyreference=lambda x: [DN(i) for i in x] == \ + [DN(('cn','global_policy'),('cn',api.env.realm), + ('cn','kerberos'),api.env.basedn)], + memberof_group=[u'ipausers'], has_keytab=False, has_password=False, ), |