summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc/test_user_plugin.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-07-27 16:35:23 -0400
committerRob Crittenden <rcritten@redhat.com>2010-08-06 15:32:37 -0400
commit2d7d047cbf9375a4c75196f13ac1e0c439ae9e8b (patch)
treec30749ec5472dcbfb54165ec5f0c28f87377fe08 /tests/test_xmlrpc/test_user_plugin.py
parent252b73fb3ec3cfb6c5efb4b93db321eedd3745e1 (diff)
downloadfreeipa-2d7d047cbf9375a4c75196f13ac1e0c439ae9e8b.tar.gz
freeipa-2d7d047cbf9375a4c75196f13ac1e0c439ae9e8b.tar.xz
freeipa-2d7d047cbf9375a4c75196f13ac1e0c439ae9e8b.zip
Add optional error message to pattern validator
The pattern validator by default displays the pattern that is being matched against. This isn't helpful, particularly for very hairy patterns. This adds a new parameter, pattern_errmsg, that is displayed on errors if set. ticket #11
Diffstat (limited to 'tests/test_xmlrpc/test_user_plugin.py')
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index 467eacf4e..18c5b45f2 100644
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ b/tests/test_xmlrpc/test_user_plugin.py
@@ -31,6 +31,9 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
user_memberof = (u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,)
user1=u'tuser1'
+invaliduser1=u'+tuser1'
+invaliduser2=u'tuser1234567890123456789012345678901234567890'
+
class test_user(Declarative):
@@ -78,6 +81,7 @@ class test_user(Declarative):
objectclass=objectclasses.user,
sn=[u'User1'],
uid=[user1],
+ uidnumber=[fuzzy_digits],
ipauniqueid=[fuzzy_uuid],
dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
),
@@ -183,6 +187,8 @@ class test_user(Declarative):
sn=[u'Administrator'],
uid=[u'admin'],
memberof_group=[u'admins'],
+ memberof_rolegroup=[u'replicaadmin'],
+ memberof_taskgroup=[u'managereplica', u'deletereplica'],
),
dict(
dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
@@ -299,4 +305,17 @@ class test_user(Declarative):
),
+ dict(
+ desc='Test an invalid login name %r' % invaliduser1,
+ command=('user_add', [invaliduser1], dict(givenname=u'Test', sn=u'User1')),
+ expected=errors.ValidationError(name='uid', error='may only include letters, numbers, _, -, . and $'),
+ ),
+
+
+ dict(
+ desc='Test a login name that is too long %r' % invaliduser2,
+ command=('user_add', [invaliduser2], dict(givenname=u'Test', sn=u'User1')),
+ expected=errors.ValidationError(name='uid', error='can be at most 33 characters'),
+ ),
+
]