diff options
author | Tomas Babej <tbabej@redhat.com> | 2014-04-29 17:04:29 +0200 |
---|---|---|
committer | Alexander Bokovoy <abokovoy@redhat.com> | 2014-05-05 19:01:04 +0300 |
commit | 473a9fd23800b46b4608465ae47da523e8a2861f (patch) | |
tree | ad1fcdecacc16363ee2d061316169ddf772df9da /ipatests | |
parent | 4568a52953bc8e0193d586ebc3d8bdbd3e3e0fa0 (diff) | |
download | freeipa-473a9fd23800b46b4608465ae47da523e8a2861f.tar.gz freeipa-473a9fd23800b46b4608465ae47da523e8a2861f.tar.xz freeipa-473a9fd23800b46b4608465ae47da523e8a2861f.zip |
ipatests: Add coverage for setting krbPrincipalExpiration
Part of: https://fedorahosted.org/freeipa/ticket/3306
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r-- | ipatests/test_xmlrpc/test_user_plugin.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index c4ae123f9..495541341 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -23,6 +23,7 @@ Test the `ipalib/plugins/user.py` module. """ +import datetime import re from ipalib import api, errors @@ -63,6 +64,11 @@ invalidlanguage3 = u'en-us;q=0.1234' invalidlanguage4 = u'en-us;q=1.1' invalidlanguage5 = u'en-us;q=1.0000' +principal_expiration_string = "2020-12-07T19:54:13Z" +principal_expiration_date = datetime.datetime(2020, 12, 7, 19, 54, 13) + +invalid_expiration_string = "2020-12-07 19:54:13" +expired_expiration_string = "1991-12-07T19:54:13Z" # Date in ISO format (2013-12-10T12:00:00) isodate_re = re.compile('^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$') @@ -1551,4 +1557,28 @@ class test_user(Declarative): ), ), + dict( + desc='Set principal expiration "%s"' % principal_expiration_string, + command=('user_mod', [user1], + dict(krbprincipalexpiration=principal_expiration_string)), + expected=dict( + result=get_user_result(user1, u'Test', u'User1', 'mod', + krbprincipalexpiration=[principal_expiration_date], + ), + value=user1, + summary='Modified user "%s"' % user1, + ), + ), + + dict( + desc='Set principal expiration "%s"' % invalid_expiration_string, + command=('user_mod', [user1], + dict(krbprincipalexpiration=invalid_expiration_string)), + expected=errors.ConversionError(name='principal_expiration', + error=(u'does not match any of accepted formats: ' + '%Y%m%d%H%M%SZ, %Y-%m-%dT%H:%M:%SZ, %Y-%m-%dT%H:%MZ, ' + '%Y-%m-%dZ, %Y-%m-%d %H:%M:%SZ, %Y-%m-%d %H:%MZ') + ), + ), + ] |