summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc/test_user_plugin.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-03-27 09:27:11 -0400
committerRob Crittenden <rcritten@redhat.com>2012-04-10 21:05:45 -0400
commit6d0e4e58fcc33f8c4514750eb6e5d7b5882efef8 (patch)
treed576654b11cb834c01701e855bbf324aa1ce2171 /tests/test_xmlrpc/test_user_plugin.py
parent689bea65757bae66b387acde3ffc7897e6b0ec3b (diff)
downloadfreeipa-6d0e4e58fcc33f8c4514750eb6e5d7b5882efef8.tar.gz
freeipa-6d0e4e58fcc33f8c4514750eb6e5d7b5882efef8.tar.xz
freeipa-6d0e4e58fcc33f8c4514750eb6e5d7b5882efef8.zip
Fix expected error messages in tests
Have the test suite check error messages. Since XMLRPC doesn't give us structured error information, just compare the resulting text. Fix messages that tests expect to cause. Minor changes: Make netgroup-mod's NotFound message consistent with other objects and methods. In test_automember_plugin, test with nonexistent automember rules of both types, instead of nonexistent users. https://fedorahosted.org/freeipa/ticket/2549
Diffstat (limited to 'tests/test_xmlrpc/test_user_plugin.py')
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py44
1 files changed, 27 insertions, 17 deletions
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index 3fcd10a1e..537768107 100644
--- a/tests/test_xmlrpc/test_user_plugin.py
+++ b/tests/test_xmlrpc/test_user_plugin.py
@@ -61,28 +61,28 @@ class test_user(Declarative):
dict(
desc='Try to retrieve non-existent %r' % user1,
command=('user_show', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: user not found' % user1),
),
dict(
desc='Try to update non-existent %r' % user1,
command=('user_mod', [user1], dict(givenname=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: user not found' % user1),
),
dict(
desc='Try to delete non-existent %r' % user1,
command=('user_del', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: user not found' % user1),
),
dict(
desc='Try to rename non-existent %r' % user1,
command=('user_mod', [user1], dict(setattr=u'uid=tuser')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: user not found' % user1),
),
@@ -132,7 +132,8 @@ class test_user(Declarative):
command=(
'user_add', [user1], dict(givenname=u'Test', sn=u'User1')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'user with name "%s" already exists' % user1),
),
@@ -387,7 +388,8 @@ class test_user(Declarative):
command=(
'user_mod', [user1], dict(setattr=u'krbmaxticketlife=88000')
),
- expected=errors.ObjectclassViolation(info='attribute "krbmaxticketlife" not allowed'),
+ expected=errors.ObjectclassViolation(
+ info=u'attribute "krbmaxticketlife" not allowed'),
),
@@ -485,7 +487,7 @@ class test_user(Declarative):
dict(
desc='Try to delete non-existent %r' % user1,
command=('user_del', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'tuser1: user not found'),
),
@@ -584,7 +586,8 @@ class test_user(Declarative):
dict(
desc='Make non-existent %r the manager of %r' % (renameduser1, user2),
command=('user_mod', [user2], dict(manager=renameduser1)),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'manager %s not found' % renameduser1),
),
@@ -625,28 +628,31 @@ class test_user(Declarative):
dict(
desc='Try to retrieve non-existent %r' % user1,
command=('user_show', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: user not found' % user1),
),
dict(
desc='Try to update non-existent %r' % user1,
command=('user_mod', [user1], dict(givenname=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: user not found' % user1),
),
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 $'),
+ expected=errors.ValidationError(name='login',
+ error=u'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'),
+ command=('user_add', [invaliduser2],
+ dict(givenname=u'Test', sn=u'User1')),
+ expected=errors.ValidationError(name='login',
+ error='can be at most 32 characters'),
),
@@ -655,14 +661,16 @@ class test_user(Declarative):
dict(
desc='Test that validation is disabled on deletes',
command=('user_del', [invaliduser1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: user not found' % invaliduser1),
),
dict(
desc='Test that validation is disabled on show',
command=('user_show', [invaliduser1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: user not found' % invaliduser1),
),
@@ -681,14 +689,16 @@ class test_user(Declarative):
dict(
desc='Try to rename to invalid username %r' % user1,
command=('user_mod', [user1], dict(rename=invaliduser1)),
- expected=errors.ValidationError(name='uid', error='may only include letters, numbers, _, -, . and $'),
+ expected=errors.ValidationError(name='rename',
+ error=u'may only include letters, numbers, _, -, . and $'),
),
dict(
desc='Try to rename to a username that is too long %r' % user1,
command=('user_mod', [user1], dict(rename=invaliduser2)),
- expected=errors.ValidationError(name='uid', error='can be at most 33 characters'),
+ expected=errors.ValidationError(name='login',
+ error='can be at most 32 characters'),
),