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
This commit is contained in:
Petr Viktorin
2012-03-27 09:27:11 -04:00
committed by Rob Crittenden
parent 689bea6575
commit 6d0e4e58fc
20 changed files with 340 additions and 185 deletions

View File

@@ -61,21 +61,24 @@ class test_permission(Declarative):
dict(
desc='Try to retrieve non-existent %r' % permission1,
command=('permission_show', [permission1], {}),
expected=errors.NotFound(reason='no such entry'),
expected=errors.NotFound(
reason=u'%s: permission not found' % permission1),
),
dict(
desc='Try to update non-existent %r' % permission1,
command=('permission_mod', [permission1], dict(permissions=u'all')),
expected=errors.NotFound(reason='no such entry'),
expected=errors.NotFound(
reason=u'%s: permission not found' % permission1),
),
dict(
desc='Try to delete non-existent %r' % permission1,
command=('permission_del', [permission1], {}),
expected=errors.NotFound(reason='no such entry'),
expected=errors.NotFound(
reason=u'%s: permission not found' % permission1),
),
@@ -516,21 +519,24 @@ class test_permission(Declarative):
dict(
desc='Try to delete non-existent %r' % permission1,
command=('permission_del', [permission1], {}),
expected=errors.NotFound(reason='no such entry'),
expected=errors.NotFound(
reason=u'%s: permission not found' % permission1),
),
dict(
desc='Try to retrieve non-existent %r' % permission1,
command=('permission_show', [permission1], {}),
expected=errors.NotFound(reason='no such entry'),
expected=errors.NotFound(
reason=u'%s: permission not found' % permission1),
),
dict(
desc='Try to update non-existent %r' % permission1,
command=('permission_mod', [permission1], dict(rename=u'Foo')),
expected=errors.NotFound(reason='no such entry'),
expected=errors.NotFound(
reason=u'%s: permission not found' % permission1),
),
@@ -575,7 +581,7 @@ class test_permission(Declarative):
permissions=u'write',
)
),
expected=errors.NotFound(reason='group not found'),
expected=errors.NotFound(reason=u'nonexisting: group not found'),
),
dict(
@@ -603,8 +609,9 @@ class test_permission(Declarative):
dict(
desc='Try to update non-existent memberof of %r' % permission1,
command=('permission_mod', [permission1], dict(memberof=u'nonexisting')),
expected=errors.NotFound(reason='group not found'),
command=('permission_mod', [permission1], dict(
memberof=u'nonexisting')),
expected=errors.NotFound(reason=u'nonexisting: group not found'),
),
dict(