summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_group_plugin.py17
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py19
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py
index 620f3eac..a8940a0d 100644
--- a/tests/test_xmlrpc/test_group_plugin.py
+++ b/tests/test_xmlrpc/test_group_plugin.py
@@ -28,6 +28,9 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
group1 = u'testgroup1'
group2 = u'testgroup2'
+invalidgroup1=u'+tgroup1'
+invalidgroup2=u'tgroup1234567890123456789012345678901234567890'
+
class test_group(Declarative):
cleanup_commands = [
@@ -511,4 +514,18 @@ class test_group(Declarative):
expected=errors.NotFound(reason='no such entry'),
),
+ dict(
+ desc='Test an invalid group name %r' % invalidgroup1,
+ command=('group_add', [invalidgroup1], dict(description=u'Test')),
+ expected=errors.ValidationError(name='cn', error='may only include letters, numbers, _, -, . and $'),
+ ),
+
+
+ dict(
+ desc='Test a group name that is too long %r' % invalidgroup2,
+ command=('group_add', [invalidgroup2], dict(description=u'Test')),
+ expected=errors.ValidationError(name='cn', error='can be at most 33 characters'),
+ ),
+
+
]
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index 467eacf4..18c5b45f 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'),
+ ),
+
]