summaryrefslogtreecommitdiffstats
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:06:07 -0400
commit94810d5adb784f6fb7408532d66ba54065f9fe6e (patch)
tree101677f8277db0133cd492d78e7bd0174181d19b
parent0ad60e57b11f6aedff0a2638f98fd9963111ba9d (diff)
downloadfreeipa.git-94810d5adb784f6fb7408532d66ba54065f9fe6e.tar.gz
freeipa.git-94810d5adb784f6fb7408532d66ba54065f9fe6e.tar.xz
freeipa.git-94810d5adb784f6fb7408532d66ba54065f9fe6e.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
-rw-r--r--ipalib/plugins/netgroup.py5
-rw-r--r--tests/test_xmlrpc/test_attr.py5
-rw-r--r--tests/test_xmlrpc/test_automember_plugin.py39
-rw-r--r--tests/test_xmlrpc/test_delegation_plugin.py11
-rw-r--r--tests/test_xmlrpc/test_dns_plugin.py75
-rw-r--r--tests/test_xmlrpc/test_group_plugin.py49
-rw-r--r--tests/test_xmlrpc/test_hbacsvcgroup_plugin.py13
-rw-r--r--tests/test_xmlrpc/test_host_plugin.py46
-rw-r--r--tests/test_xmlrpc/test_hostgroup_plugin.py15
-rw-r--r--tests/test_xmlrpc/test_netgroup_plugin.py27
-rw-r--r--tests/test_xmlrpc/test_permission_plugin.py25
-rw-r--r--tests/test_xmlrpc/test_privilege_plugin.py9
-rw-r--r--tests/test_xmlrpc/test_role_plugin.py21
-rw-r--r--tests/test_xmlrpc/test_selfservice_plugin.py9
-rw-r--r--tests/test_xmlrpc/test_selinuxusermap_plugin.py42
-rw-r--r--tests/test_xmlrpc/test_service_plugin.py13
-rw-r--r--tests/test_xmlrpc/test_sudocmd_plugin.py21
-rw-r--r--tests/test_xmlrpc/test_sudocmdgroup_plugin.py46
-rw-r--r--tests/test_xmlrpc/test_user_plugin.py44
-rw-r--r--tests/test_xmlrpc/xmlrpc_test.py6
20 files changed, 338 insertions, 183 deletions
diff --git a/ipalib/plugins/netgroup.py b/ipalib/plugins/netgroup.py
index 06372a59..693c00c1 100644
--- a/ipalib/plugins/netgroup.py
+++ b/ipalib/plugins/netgroup.py
@@ -202,7 +202,10 @@ class netgroup_mod(LDAPUpdate):
msg_summary = _('Modified netgroup "%(value)s"')
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
- (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
+ try:
+ (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
+ except errors.NotFound:
+ self.obj.handle_not_found(*keys)
if is_all(options, 'usercategory') and 'memberuser' in entry_attrs:
raise errors.MutuallyExclusiveError(reason="user category cannot be set to 'all' while there are allowed users")
if is_all(options, 'hostcategory') and 'memberhost' in entry_attrs:
diff --git a/tests/test_xmlrpc/test_attr.py b/tests/test_xmlrpc/test_attr.py
index c19a6948..6877a630 100644
--- a/tests/test_xmlrpc/test_attr.py
+++ b/tests/test_xmlrpc/test_attr.py
@@ -241,7 +241,8 @@ class test_attr(Declarative):
command=(
'user_mod', [user1], dict(delattr=u'telephoneNumber=301-555-1212')
),
- expected=errors.AttrValueNotFound(attr='telephoneNumber', value='301-555-1212')
+ expected=errors.AttrValueNotFound(attr=u'telephonenumber',
+ value=u'301-555-1212')
),
@@ -345,7 +346,7 @@ class test_attr(Declarative):
command=(
'user_mod', [user1], dict(givenname=None)
),
- expected=errors.RequirementError(name='givenname'),
+ expected=errors.RequirementError(name='first'),
),
diff --git a/tests/test_xmlrpc/test_automember_plugin.py b/tests/test_xmlrpc/test_automember_plugin.py
index b59899b4..ceae8c3f 100644
--- a/tests/test_xmlrpc/test_automember_plugin.py
+++ b/tests/test_xmlrpc/test_automember_plugin.py
@@ -76,33 +76,48 @@ class test_automember(Declarative):
tests = [
dict(
- desc='Try to retrieve non-existent %r' % user1,
- command=('user_show', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ desc='Try to retrieve non-existent group rule %r' % group1,
+ command=('automember_add', [group1],
+ dict(description=u'Test desc', type=u'group')),
+ expected=errors.NotFound(reason=u'Group: %s not found!' % group1),
),
+ dict(
+ desc='Try to update non-existent group rule %r' % group1,
+ command=('automember_add', [group1], dict(type=u'group')),
+ expected=errors.NotFound(reason=u'Group: %s not found!' % group1),
+ ),
dict(
- desc='Try to update non-existent %r' % user1,
- command=('user_mod', [user1], dict(givenname=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ desc='Try to delete non-existent group rule %r' % group1,
+ command=('automember_del', [group1], dict(type=u'group')),
+ expected=errors.NotFound(reason=u': auto_member_rule not found'),
),
dict(
- desc='Try to delete non-existent %r' % user1,
- command=('user_del', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ desc='Try to retrieve non-existent hostgroup rule %r' % hostgroup1,
+ command=('automember_add', [hostgroup1],
+ dict(description=u'Test desc', type=u'hostgroup')),
+ expected=errors.NotFound(
+ reason=u'Group: %s not found!' % hostgroup1),
),
+ dict(
+ desc='Try to update non-existent hostgroup rule %r' % hostgroup1,
+ command=('automember_add', [hostgroup1], dict(type=u'hostgroup')),
+ expected=errors.NotFound(
+ reason=u'Group: %s not found!' % hostgroup1),
+ ),
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'),
+ desc='Try to delete non-existent hostgroup rule %r' % hostgroup1,
+ command=('automember_del', [hostgroup1], dict(type=u'hostgroup')),
+ expected=errors.NotFound(reason=u': auto_member_rule not found'),
),
+
dict(
desc='Create %r' % group1,
command=(
diff --git a/tests/test_xmlrpc/test_delegation_plugin.py b/tests/test_xmlrpc/test_delegation_plugin.py
index c4473b9d..95aa8287 100644
--- a/tests/test_xmlrpc/test_delegation_plugin.py
+++ b/tests/test_xmlrpc/test_delegation_plugin.py
@@ -39,21 +39,24 @@ class test_delegation(Declarative):
dict(
desc='Try to retrieve non-existent %r' % delegation1,
command=('delegation_show', [delegation1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'ACI with name "%s" not found' % delegation1),
),
dict(
desc='Try to update non-existent %r' % delegation1,
command=('delegation_mod', [delegation1], dict(group=u'admins')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'ACI with name "%s" not found' % delegation1),
),
dict(
desc='Try to delete non-existent %r' % delegation1,
command=('delegation_del', [delegation1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'ACI with name "%s" not found' % delegation1),
),
@@ -78,7 +81,7 @@ class test_delegation(Declarative):
memberof=u'nonexisting',
),
),
- expected=errors.NotFound(reason='group not found'),
+ expected=errors.NotFound(reason=u'nonexisting: group not found'),
),
# Note that we add postalCode but expect postalcode. This tests
diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py
index 96639453..661f87ad 100644
--- a/tests/test_xmlrpc/test_dns_plugin.py
+++ b/tests/test_xmlrpc/test_dns_plugin.py
@@ -82,21 +82,24 @@ class test_dns(Declarative):
dict(
desc='Try to retrieve non-existent zone %r' % dnszone1,
command=('dnszone_show', [dnszone1], {}),
- expected=errors.NotFound(reason='DNS zone not found'),
+ expected=errors.NotFound(
+ reason=u'%s: DNS zone not found' % dnszone1),
),
dict(
desc='Try to update non-existent zone %r' % dnszone1,
command=('dnszone_mod', [dnszone1], {'idnssoamname': u'foobar'}),
- expected=errors.NotFound(reason='DNS zone not found'),
+ expected=errors.NotFound(
+ reason=u'%s: DNS zone not found' % dnszone1),
),
dict(
desc='Try to delete non-existent zone %r' % dnszone1,
command=('dnszone_del', [dnszone1], {}),
- expected=errors.NotFound(reason='DNS zone not found'),
+ expected=errors.NotFound(
+ reason=u'%s: DNS zone not found' % dnszone1),
),
@@ -109,7 +112,9 @@ class test_dns(Declarative):
'ip_address' : u'1.2.3.4',
}
),
- expected=errors.ValidationError(name='idnsname', error=''),
+ expected=errors.ValidationError(name='name',
+ error=u'only letters, numbers, and - are allowed. ' +
+ u'- must not be the DNS label character'),
),
@@ -155,7 +160,8 @@ class test_dns(Declarative):
'ip_address' : u'1.2.3.4',
}
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'DNS zone with name "%s" already exists' % dnszone1),
),
dict(
@@ -446,28 +452,33 @@ class test_dns(Declarative):
dict(
desc='Try to retrieve non-existent record %r in zone %r' % (dnsres1, dnszone1),
command=('dnsrecord_show', [dnszone1, dnsres1], {}),
- expected=errors.NotFound(reason='DNS resource record not found'),
+ expected=errors.NotFound(
+ reason=u'%s: DNS resource record not found' % dnsres1),
),
dict(
desc='Try to delete non-existent record %r in zone %r' % (dnsres1, dnszone1),
command=('dnsrecord_del', [dnszone1, dnsres1], {'del_all' : True}),
- expected=errors.NotFound(reason='DNS resource record not found'),
+ expected=errors.NotFound(
+ reason=u'%s: DNS resource record not found' % dnsres1),
),
dict(
desc='Try to delete root zone record \'@\' in %r' % (dnszone1),
command=('dnsrecord_del', [dnszone1, u'@'], {'del_all' : True}),
- expected=errors.ValidationError(name='del_all', error=''),
+ expected=errors.ValidationError(name='del_all',
+ error=u"Zone record '@' cannot be deleted"),
),
dict(
desc='Try to create record with invalid name in zone %r' % dnszone1,
command=('dnsrecord_add', [dnszone1, u'invalid record'], {'arecord': u'127.0.0.1'}),
- expected=errors.ValidationError(name='idnsname', error=''),
+ expected=errors.ValidationError(name='name',
+ error=u'only letters, numbers, _, and - are allowed. ' +
+ u'- must not be the DNS label character'),
),
@@ -591,7 +602,9 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid MX record to zone %r using dnsrecord_add' % (dnszone1),
command=('dnsrecord_add', [dnszone1, u'@'], {'mxrecord': dnszone1_mname }),
- expected=errors.ValidationError(name='mxrecord', error=''),
+ expected=errors.ValidationError(name='mx_rec',
+ error=u'format must be specified as "PREFERENCE EXCHANGER" ' +
+ u' (see RFC 1035 for details)'),
),
dict(
@@ -613,7 +626,9 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid SRV record to zone %r using dnsrecord_add' % (dnszone1),
command=('dnsrecord_add', [dnszone1, u'_foo._tcp'], {'srvrecord': dnszone1_mname}),
- expected=errors.ValidationError(name='srvrecord', error=''),
+ expected=errors.ValidationError(name='srv_rec',
+ error=u'format must be specified as "PRIORITY WEIGHT PORT TARGET" ' +
+ u' (see RFC 2782 for details)'),
),
dict(
@@ -622,7 +637,9 @@ class test_dns(Declarative):
'srv_part_weight' : 0,
'srv_part_port' : 123,
'srv_part_target' : u'foo bar'}),
- expected=errors.ValidationError(name='srv_part_target', error=''),
+ expected=errors.ValidationError(name='srv_target',
+ error=u'invalid domain-name: only letters, numbers, and - ' +
+ u'are allowed. - must not be the DNS label character'),
),
dict(
@@ -634,7 +651,8 @@ class test_dns(Declarative):
'srvrecord': [u"1 100 1234 %s" \
% dnszone1_mname]}),
expected=errors.ValidationError(name='srv_target',
- error='Raw value of a DNS record was already set by a_rec option'),
+ error=u'Raw value of a DNS record was already set by ' +
+ u'"srv_rec" option'),
),
dict(
@@ -662,7 +680,8 @@ class test_dns(Declarative):
desc='Try to modify SRV record in zone %r with non-existent modified value' % (dnszone1),
command=('dnsrecord_mod', [dnszone1, u'_foo._tcp'], {'srv_part_priority': 1,
'srvrecord' : [u"0 100 1234 does.not.exist."] }),
- expected=errors.AttrValueNotFound(attr='SRV', value=u'0 100 1234 ns1.dnszone.test.'),
+ expected=errors.AttrValueNotFound(attr='SRV record',
+ value=u'0 100 1234 does.not.exist.'),
),
dict(
@@ -689,7 +708,8 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid LOC record to zone %r using dnsrecord_add' % (dnszone1),
command=('dnsrecord_add', [dnszone1, u'@'], {'locrecord': u"91 11 42.4 N 16 36 29.6 E 227.64" }),
- expected=errors.ValidationError(name='locrecord', error=''),
+ expected=errors.ValidationError(name='lat_deg',
+ error=u'can be at most 90'),
),
dict(
@@ -712,7 +732,9 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid CNAME record %r using dnsrecord_add' % (dnsres1),
command=('dnsrecord_add', [dnszone1, dnsres1], {'cnamerecord': u'-.example.com' }),
- expected=errors.ValidationError(name='cnamerecord', error=''),
+ expected=errors.ValidationError(name='hostname',
+ error=u'invalid domain-name: only letters, numbers, and - ' +
+ u'are allowed. - must not be the DNS label character'),
),
dict(
@@ -734,7 +756,9 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid KX record %r using dnsrecord_add' % (dnsres1),
command=('dnsrecord_add', [dnszone1, dnsres1], {'kxrecord': u'foo-1.example.com' }),
- expected=errors.ValidationError(name='kxrecord', error=''),
+ expected=errors.ValidationError(name='kx_rec',
+ error=u'format must be specified as "PREFERENCE EXCHANGER" ' +
+ u' (see RFC 2230 for details)'),
),
dict(
@@ -841,7 +865,8 @@ class test_dns(Declarative):
'ip_address' : u'1.2.3.4',
}
),
- expected=errors.ValidationError(name='name_from_ip', error='invalid format'),
+ expected=errors.ValidationError(name='name_from_ip',
+ error=u'invalid IP network format'),
),
dict(
@@ -881,7 +906,9 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid PTR %r to %r using dnsrecord_add' % (dnsrev1, revdnszone1),
command=('dnsrecord_add', [revdnszone1, dnsrev1], {'ptrrecord': u'-.example.com' }),
- expected=errors.ValidationError(name='ptrrecord', error=''),
+ expected=errors.ValidationError(name='hostname',
+ error=u'invalid domain-name: only letters, numbers, and - ' +
+ u'are allowed. - must not be the DNS label character'),
),
dict(
@@ -916,7 +943,8 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid allow-query to zone %r' % dnszone1,
command=('dnszone_mod', [dnszone1], {'idnsallowquery': u'localhost'}),
- expected=errors.ValidationError(name='idnsallowquery', error=''),
+ expected=errors.ValidationError(name='allow_query',
+ error=u'ACL name "localhost" is not supported'),
),
dict(
@@ -948,7 +976,8 @@ class test_dns(Declarative):
dict(
desc='Try to add invalid allow-transfer to zone %r' % dnszone1,
command=('dnszone_mod', [dnszone1], {'idnsallowtransfer': u'10.'}),
- expected=errors.ValidationError(name='idnsallowtransfer', error=''),
+ expected=errors.ValidationError(name='allow_transfer',
+ error=u"failed to detect a valid IP address from u'10.'"),
),
dict(
@@ -981,7 +1010,9 @@ class test_dns(Declarative):
desc='Try to create duplicate PTR record for %r with --a-create-reverse' % dnsres1,
command=('dnsrecord_add', [dnszone1, dnsres1], {'arecord': u'80.142.15.80',
'a_extra_create_reverse' : True}),
- expected=errors.DuplicateEntry(message=u''),
+ expected=errors.DuplicateEntry(message=u'Reverse record for IP ' +
+ u'address 80.142.15.80 already exists in reverse zone ' +
+ u'15.142.80.in-addr.arpa..'),
),
diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py
index d322c2dc..c0abcb95 100644
--- a/tests/test_xmlrpc/test_group_plugin.py
+++ b/tests/test_xmlrpc/test_group_plugin.py
@@ -48,28 +48,28 @@ class test_group(Declarative):
dict(
desc='Try to retrieve non-existent %r' % group1,
command=('group_show', [group1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
dict(
desc='Try to update non-existent %r' % group1,
command=('group_mod', [group1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
dict(
desc='Try to delete non-existent %r' % group1,
command=('group_del', [group1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
dict(
desc='Try to rename non-existent %r' % group1,
command=('group_mod', [group1], dict(setattr=u'cn=%s' % renamedgroup1)),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
@@ -99,7 +99,8 @@ class test_group(Declarative):
command=(
'group_add', [group1], dict(description=u'Test desc 1')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'group with name "%s" already exists' % group1),
),
@@ -216,21 +217,21 @@ class test_group(Declarative):
dict(
desc='Try to retrieve non-existent %r' % group2,
command=('group_show', [group2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group2),
),
dict(
desc='Try to update non-existent %r' % group2,
command=('group_mod', [group2], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group2),
),
dict(
desc='Try to delete non-existent %r' % group2,
command=('group_del', [group2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group2),
),
@@ -261,7 +262,8 @@ class test_group(Declarative):
command=(
'group_add', [group2], dict(description=u'Test desc 2')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'group with name "%s" already exists' % group2),
),
@@ -543,21 +545,21 @@ class test_group(Declarative):
dict(
desc='Try to delete non-existent %r' % group1,
command=('group_del', [group1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
dict(
desc='Try to retrieve non-existent %r' % group1,
command=('group_show', [group1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
dict(
desc='Try to update non-existent %r' % group1,
command=('group_mod', [group1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group1),
),
@@ -578,27 +580,28 @@ class test_group(Declarative):
dict(
desc='Try to delete non-existent %r' % group2,
command=('group_del', [group2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group2),
),
dict(
desc='Try to retrieve non-existent %r' % group2,
command=('group_show', [group2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group2),
),
dict(
desc='Try to update non-existent %r' % group2,
command=('group_mod', [group2], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % group2),
),
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 $'),
+ expected=errors.ValidationError(name='group_name',
+ error=u'may only include letters, numbers, _, -, . and $'),
),
# The assumption on these next 4 tests is that if we don't get a
@@ -606,21 +609,24 @@ class test_group(Declarative):
dict(
desc='Test that validation is disabled on mods',
command=('group_mod', [invalidgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: group not found' % invalidgroup1),
),
dict(
desc='Test that validation is disabled on deletes',
command=('group_del', [invalidgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: group not found' % invalidgroup1),
),
dict(
desc='Test that validation is disabled on show',
command=('group_show', [invalidgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: group not found' % invalidgroup1),
),
@@ -732,11 +738,10 @@ class test_group(Declarative):
)
),
-
dict(
desc='Verify that %r is really gone' % user1,
command=('group_show', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % user1),
),
dict(
@@ -789,7 +794,7 @@ class test_group(Declarative):
dict(
desc='Verify the managed group %r was not created' % user1,
command=('group_show', [user1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: group not found' % user1),
),
]
diff --git a/tests/test_xmlrpc/test_hbacsvcgroup_plugin.py b/tests/test_xmlrpc/test_hbacsvcgroup_plugin.py
index ba30854a..1552f46c 100644
--- a/tests/test_xmlrpc/test_hbacsvcgroup_plugin.py
+++ b/tests/test_xmlrpc/test_hbacsvcgroup_plugin.py
@@ -47,7 +47,8 @@ class test_hbacsvcgroup(Declarative):
dict(
desc='Try to retrieve non-existent %r' % hbacsvcgroup1,
command=('hbacsvcgroup_show', [hbacsvcgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: HBAC service group not found' % hbacsvcgroup1),
),
@@ -56,14 +57,16 @@ class test_hbacsvcgroup(Declarative):
command=('hbacsvcgroup_mod', [hbacsvcgroup1],
dict(description=u'Updated hbacsvcgroup 1')
),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: HBAC service group not found' % hbacsvcgroup1),
),
dict(
desc='Try to delete non-existent %r' % hbacsvcgroup1,
command=('hbacsvcgroup_del', [hbacsvcgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: HBAC service group not found' % hbacsvcgroup1),
),
@@ -91,7 +94,9 @@ class test_hbacsvcgroup(Declarative):
command=('hbacsvcgroup_add', [hbacsvcgroup1],
dict(description=u'Test hbacsvcgroup 1')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'HBAC service group with name "%s" already exists' %
+ hbacsvcgroup1),
),
diff --git a/tests/test_xmlrpc/test_host_plugin.py b/tests/test_xmlrpc/test_host_plugin.py
index 4ed4c17a..b7b3567b 100644
--- a/tests/test_xmlrpc/test_host_plugin.py
+++ b/tests/test_xmlrpc/test_host_plugin.py
@@ -72,21 +72,24 @@ class test_host(Declarative):
dict(
desc='Try to retrieve non-existent %r' % fqdn1,
command=('host_show', [fqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host not found' % fqdn1),
),
dict(
desc='Try to update non-existent %r' % fqdn1,
command=('host_mod', [fqdn1], dict(description=u'Nope')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host not found' % fqdn1),
),
dict(
desc='Try to delete non-existent %r' % fqdn1,
command=('host_del', [fqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host not found' % fqdn1),
),
@@ -127,7 +130,8 @@ class test_host(Declarative):
force=True,
),
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(message=u'host with name ' +
+ u'"%s" already exists' % fqdn1),
),
@@ -530,7 +534,9 @@ class test_host(Declarative):
dict(
desc='Add an illegal MAC address to %r' % fqdn1,
command=('host_mod', [fqdn1], dict(macaddress=[u'xx'])),
- expected=errors.ValidationError(name='macaddress', error='invalid \'macaddress\': Must be of the form HH:HH:HH:HH:HH:HH, where each H is a hexadecimal character.'),
+ expected=errors.ValidationError(name='macaddress',
+ error=u'Must be of the form HH:HH:HH:HH:HH:HH, where ' +
+ u'each H is a hexadecimal character.'),
),
@@ -548,21 +554,21 @@ class test_host(Declarative):
dict(
desc='Try to retrieve non-existent %r' % fqdn1,
command=('host_show', [fqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: host not found' % fqdn1),
),
dict(
desc='Try to update non-existent %r' % fqdn1,
command=('host_mod', [fqdn1], dict(description=u'Nope')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: host not found' % fqdn1),
),
dict(
desc='Try to delete non-existent %r' % fqdn1,
command=('host_del', [fqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: host not found' % fqdn1),
),
# Test deletion using a non-fully-qualified hostname. Services
@@ -636,7 +642,8 @@ class test_host(Declarative):
dict(
desc='Try to add host not in DNS %r without force' % fqdn2,
command=('host_add', [fqdn2], {}),
- expected=errors.DNSNotARecordError(reason='Host does not have corresponding DNS A record'),
+ expected=errors.DNSNotARecordError(
+ reason=u'Host does not have corresponding DNS A record'),
),
@@ -660,7 +667,7 @@ class test_host(Declarative):
krbprincipalname=[u'host/%s@%s' % (fqdn2, api.env.realm)],
objectclass=objectclasses.host,
ipauniqueid=[fuzzy_uuid],
- managedby_host=[u'%s' % fqdn2],
+ managedby_host=[fqdn2],
has_keytab=False,
has_password=False,
),
@@ -673,21 +680,25 @@ class test_host(Declarative):
dict(
desc='Delete the current host (master?) %s should be caught' % api.env.host,
command=('host_del', [api.env.host], {}),
- expected=errors.ValidationError(name='fqdn', error='An IPA master host cannot be deleted or disabled'),
+ expected=errors.ValidationError(name='hostname',
+ error=u'An IPA master host cannot be deleted or disabled'),
),
dict(
desc='Disable the current host (master?) %s should be caught' % api.env.host,
command=('host_disable', [api.env.host], {}),
- expected=errors.ValidationError(name='fqdn', error='An IPA master host cannot be deleted or disabled'),
+ expected=errors.ValidationError(name='hostname',
+ error=u'An IPA master host cannot be deleted or disabled'),
),
dict(
desc='Test that validation is enabled on adds',
command=('host_add', [invalidfqdn1], {}),
- expected=errors.ValidationError(name='fqdn', error='may only include letters, numbers, and -'),
+ expected=errors.ValidationError(name='hostname',
+ error=u'invalid domain-name: only letters, numbers, and - ' +
+ u'are allowed. - must not be the DNS label character'),
),
@@ -696,21 +707,24 @@ class test_host(Declarative):
dict(
desc='Test that validation is disabled on mods',
command=('host_mod', [invalidfqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host not found' % invalidfqdn1),
),
dict(
desc='Test that validation is disabled on deletes',
command=('host_del', [invalidfqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host not found' % invalidfqdn1),
),
dict(
desc='Test that validation is disabled on show',
command=('host_show', [invalidfqdn1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host not found' % invalidfqdn1),
),
diff --git a/tests/test_xmlrpc/test_hostgroup_plugin.py b/tests/test_xmlrpc/test_hostgroup_plugin.py
index f5c2efb7..eda5f02f 100644
--- a/tests/test_xmlrpc/test_hostgroup_plugin.py
+++ b/tests/test_xmlrpc/test_hostgroup_plugin.py
@@ -51,7 +51,8 @@ class test_hostgroup(Declarative):
dict(
desc='Try to retrieve non-existent %r' % hostgroup1,
command=('hostgroup_show', [hostgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host group not found' % hostgroup1),
),
@@ -60,21 +61,24 @@ class test_hostgroup(Declarative):
command=('hostgroup_mod', [hostgroup1],
dict(description=u'Updated hostgroup 1')
),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host group not found' % hostgroup1),
),
dict(
desc='Try to delete non-existent %r' % hostgroup1,
command=('hostgroup_del', [hostgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: host group not found' % hostgroup1),
),
dict(
desc='Test an invalid hostgroup name %r' % invalidhostgroup1,
command=('hostgroup_add', [invalidhostgroup1], dict(description=u'Test')),
- expected=errors.ValidationError(name='cn', error='may only include letters, numbers, _, - and .'),
+ expected=errors.ValidationError(name='hostgroup_name',
+ error=u'may only include letters, numbers, _, -, and .'),
),
@@ -105,7 +109,8 @@ class test_hostgroup(Declarative):
command=('hostgroup_add', [hostgroup1],
dict(description=u'Test hostgroup 1')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(message=
+ u'host group with name "%s" already exists' % hostgroup1),
),
diff --git a/tests/test_xmlrpc/test_netgroup_plugin.py b/tests/test_xmlrpc/test_netgroup_plugin.py
index 33b2c6da..afb2ac73 100644
--- a/tests/test_xmlrpc/test_netgroup_plugin.py
+++ b/tests/test_xmlrpc/test_netgroup_plugin.py
@@ -81,7 +81,8 @@ class test_netgroup(Declarative):
dict(
desc='Try to retrieve non-existent %r' % netgroup1,
command=('netgroup_show', [netgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: netgroup not found' % netgroup1),
),
@@ -90,35 +91,42 @@ class test_netgroup(Declarative):
command=('netgroup_mod', [netgroup1],
dict(description=u'Updated hostgroup 1')
),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: netgroup not found' % netgroup1),
),
dict(
desc='Try to delete non-existent %r' % netgroup1,
command=('netgroup_del', [netgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: netgroup not found' % netgroup1),
),
dict(
desc='Test an invalid netgroup name %r' % invalidnetgroup1,
command=('netgroup_add', [invalidnetgroup1], dict(description=u'Test')),
- expected=errors.ValidationError(name='cn', error='may only include letters, numbers, _, - and .'),
+ expected=errors.ValidationError(name='name',
+ error=u'may only include letters, numbers, _, -, and .'),
),
dict(
desc='Test an invalid nisdomain1 name %r' % invalidnisdomain1,
- command=('netgroup_add', [netgroup1], dict(description=u'Test',nisdomainname=invalidnisdomain1)),
- expected=errors.ValidationError(name='nisdomainname', error='may only include letters, numbers, _, - and .'),
+ command=('netgroup_add', [netgroup1],
+ dict(description=u'Test',nisdomainname=invalidnisdomain1)),
+ expected=errors.ValidationError(name='nisdomain',
+ error='may only include letters, numbers, _, -, and .'),
),
dict(
desc='Test an invalid nisdomain2 name %r' % invalidnisdomain2,
- command=('netgroup_add', [netgroup1], dict(description=u'Test',nisdomainname=invalidnisdomain2)),
- expected=errors.ValidationError(name='nisdomainname', error='may only include letters, numbers, _, - and .'),
+ command=('netgroup_add', [netgroup1],
+ dict(description=u'Test',nisdomainname=invalidnisdomain2)),
+ expected=errors.ValidationError(name='nisdomain',
+ error='may only include letters, numbers, _, -, and .'),
),
@@ -169,7 +177,8 @@ class test_netgroup(Declarative):
command=('netgroup_add', [netgroup1],
dict(description=u'Test netgroup 1')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'netgroup with name "%s" already exists' % netgroup1),
),
diff --git a/tests/test_xmlrpc/test_permission_plugin.py b/tests/test_xmlrpc/test_permission_plugin.py
index ab285886..d730399c 100644
--- a/tests/test_xmlrpc/test_permission_plugin.py
+++ b/tests/test_xmlrpc/test_permission_plugin.py
@@ -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(
diff --git a/tests/test_xmlrpc/test_privilege_plugin.py b/tests/test_xmlrpc/test_privilege_plugin.py
index 94422558..eb812068 100644
--- a/tests/test_xmlrpc/test_privilege_plugin.py
+++ b/tests/test_xmlrpc/test_privilege_plugin.py
@@ -52,21 +52,24 @@ class test_privilege(Declarative):
dict(
desc='Try to retrieve non-existent %r' % privilege1,
command=('privilege_show', [privilege1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: privilege not found' % privilege1),
),
dict(
desc='Try to update non-existent %r' % privilege1,
command=('privilege_mod', [privilege1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: privilege not found' % privilege1),
),
dict(
desc='Try to delete non-existent %r' % privilege1,
command=('privilege_del', [privilege1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: privilege not found' % privilege1),
),
diff --git a/tests/test_xmlrpc/test_role_plugin.py b/tests/test_xmlrpc/test_role_plugin.py
index 8a5dede2..62bc6ead 100644
--- a/tests/test_xmlrpc/test_role_plugin.py
+++ b/tests/test_xmlrpc/test_role_plugin.py
@@ -61,28 +61,28 @@ class test_role(Declarative):
dict(
desc='Try to retrieve non-existent %r' % role1,
command=('role_show', [role1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
dict(
desc='Try to update non-existent %r' % role1,
command=('role_mod', [role1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
dict(
desc='Try to delete non-existent %r' % role1,
command=('role_del', [role1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
dict(
desc='Try to rename non-existent %r' % role1,
command=('role_mod', [role1], dict(setattr=u'cn=%s' % renamedrole1)),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
@@ -103,7 +103,8 @@ class test_role(Declarative):
command=('role_add', [invalidrole1],
dict(description=u'role desc 1')
),
- expected=errors.ValidationError(name='cn', error='Leading and trailing spaces are not allowed'),
+ expected=errors.ValidationError(name='name',
+ error=u'Leading and trailing spaces are not allowed'),
),
@@ -516,21 +517,21 @@ class test_role(Declarative):
dict(
desc='Try to delete non-existent %r' % role1,
command=('role_del', [role1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
dict(
- desc='Try to retrieve non-existent %r' % role1,
- command=('role_show', [group1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ desc='Try to show non-existent %r' % role1,
+ command=('role_show', [role1], {}),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
dict(
desc='Try to update non-existent %r' % role1,
command=('role_mod', [role1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'%s: role not found' % role1),
),
diff --git a/tests/test_xmlrpc/test_selfservice_plugin.py b/tests/test_xmlrpc/test_selfservice_plugin.py
index 3546701d..e60eb5d5 100644
--- a/tests/test_xmlrpc/test_selfservice_plugin.py
+++ b/tests/test_xmlrpc/test_selfservice_plugin.py
@@ -39,21 +39,24 @@ class test_selfservice(Declarative):
dict(
desc='Try to retrieve non-existent %r' % selfservice1,
command=('selfservice_show', [selfservice1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'ACI with name "%s" not found' % selfservice1),
),
dict(
desc='Try to update non-existent %r' % selfservice1,
command=('selfservice_mod', [selfservice1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'ACI with name "%s" not found' % selfservice1),
),
dict(
desc='Try to delete non-existent %r' % selfservice1,
command=('selfservice_del', [selfservice1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'ACI with name "%s" not found' % selfservice1),
),
diff --git a/tests/test_xmlrpc/test_selinuxusermap_plugin.py b/tests/test_xmlrpc/test_selinuxusermap_plugin.py
index 2fdccf3e..2f6f52c6 100644
--- a/tests/test_xmlrpc/test_selinuxusermap_plugin.py
+++ b/tests/test_xmlrpc/test_selinuxusermap_plugin.py
@@ -60,21 +60,24 @@ class test_selinuxusermap(Declarative):
dict(
desc='Try to retrieve non-existent %r' % rule1,
command=('selinuxusermap_show', [rule1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: SELinux User Map rule not found' % rule1),
),
dict(
desc='Try to update non-existent %r' % rule1,
command=('selinuxusermap_mod', [rule1], dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: SELinux User Map rule not found' % rule1),
),
dict(
desc='Try to delete non-existent %r' % rule1,
command=('selinuxusermap_del', [rule1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: SELinux User Map rule not found' % rule1),
),
@@ -103,7 +106,8 @@ class test_selinuxusermap(Declarative):
command=(
'selinuxusermap_add', [rule1], dict(ipaselinuxuser=selinuxuser1)
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(message=u'SELinux User Map rule ' +
+ u'with name "%s" already exists' % rule1),
),
@@ -479,7 +483,8 @@ class test_selinuxusermap(Declarative):
command=(
'selinuxusermap_mod', [rule1], dict(seealso=hbacrule1)
),
- expected=errors.MutuallyExclusiveError(reason=u'cannot have both'),
+ expected=errors.MutuallyExclusiveError(
+ reason=u'HBAC rule and local members cannot both be set'),
),
@@ -521,7 +526,8 @@ class test_selinuxusermap(Declarative):
command=(
'selinuxusermap_mod', [rule1], dict(seealso=u'notfound')
),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'HBAC rule notfound not found'),
),
@@ -546,14 +552,16 @@ class test_selinuxusermap(Declarative):
dict(
desc='Add user to %r that has HBAC' % rule1,
command=('selinuxusermap_add_user', [rule1], dict(user=user1)),
- expected=errors.MutuallyExclusiveError(reason=u'cannot have both'),
+ expected=errors.MutuallyExclusiveError(
+ reason=u'HBAC rule and local members cannot both be set'),
),
dict(
desc='Add host to %r that has HBAC' % rule1,
command=('selinuxusermap_add_host', [rule1], dict(host=host1)),
- expected=errors.MutuallyExclusiveError(reason=u'cannot have both'),
+ expected=errors.MutuallyExclusiveError(
+ reason=u'HBAC rule and local members cannot both be set'),
),
@@ -592,17 +600,19 @@ class test_selinuxusermap(Declarative):
dict(
desc='Try to delete non-existent %r' % rule1,
command=('selinuxusermap_del', [rule1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: SELinux User Map rule not found' % rule1),
),
# Some negative tests
dict(
- desc='Create rule with unknown user%r' % rule1,
+ desc='Create rule with unknown user %r' % rule1,
command=(
'selinuxusermap_add', [rule1], dict(ipaselinuxuser=u'notfound')
),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(reason=u'SELinux user notfound not ' +
+ u'found in ordering list (in config)'),
),
@@ -611,7 +621,8 @@ class test_selinuxusermap(Declarative):
command=(
'selinuxusermap_add', [rule1], dict(ipaselinuxuser=u'bad+user')
),
- expected=errors.ValidationError(name='ipaselinuxuser', error='invalid name'),
+ expected=errors.ValidationError(name='selinuxuser',
+ error=u'Invalid SELinux user name, only a-Z and _ are allowed'),
),
@@ -620,7 +631,8 @@ class test_selinuxusermap(Declarative):
command=(
'selinuxusermap_add', [rule1], dict(ipaselinuxuser=u'xguest_u:s999')
),
- expected=errors.ValidationError(name='ipaselinuxuser', error='invalid name'),
+ expected=errors.ValidationError(name='selinuxuser',
+ error=u'Invalid MLS value, must match s[0-15](-s[0-15])'),
),
@@ -629,7 +641,9 @@ class test_selinuxusermap(Declarative):
command=(
'selinuxusermap_add', [rule1], dict(ipaselinuxuser=u'xguest_u:s0:p88')
),
- expected=errors.ValidationError(name='ipaselinuxuser', error='invalid name'),
+ expected=errors.ValidationError(name='selinuxuser',
+ error=u'Invalid MCS value, must match c[0-1023].c[0-1023] ' +
+ u'and/or c[0-1023]-c[0-c0123]'),
),
]
diff --git a/tests/test_xmlrpc/test_service_plugin.py b/tests/test_xmlrpc/test_service_plugin.py
index 1c3a83a1..494a9fc7 100644
--- a/tests/test_xmlrpc/test_service_plugin.py
+++ b/tests/test_xmlrpc/test_service_plugin.py
@@ -61,7 +61,8 @@ class test_service(Declarative):
dict(
desc='Try to retrieve non-existent %r' % service1,
command=('service_show', [service1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: service not found' % service1),
),
@@ -191,7 +192,8 @@ class test_service(Declarative):
force=True,
),
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'service with name "%s" already exists' % service1),
),
@@ -362,7 +364,9 @@ class test_service(Declarative):
dict(
desc='Update %r with a bad certificate' % service1,
command=('service_mod', [service1], dict(usercertificate=badservercert)),
- expected=errors.CertificateOperationError(error='exact error msg not needed'),
+ expected=errors.CertificateOperationError(
+ error=u'Issuer "CN=IPA Test Certificate Authority" does not ' +
+ u'match the expected issuer'),
),
@@ -432,7 +436,8 @@ class test_service(Declarative):
dict(
desc='Try to retrieve non-existent %r' % service1,
command=('service_show', [service1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: service not found' % service1),
),
diff --git a/tests/test_xmlrpc/test_sudocmd_plugin.py b/tests/test_xmlrpc/test_sudocmd_plugin.py
index cbbd26cd..4574f774 100644
--- a/tests/test_xmlrpc/test_sudocmd_plugin.py
+++ b/tests/test_xmlrpc/test_sudocmd_plugin.py
@@ -40,21 +40,24 @@ class test_sudocmd(Declarative):
dict(
desc='Try to retrieve non-existent %r' % sudocmd1,
command=('sudocmd_show', [sudocmd1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
dict(
desc='Try to update non-existent %r' % sudocmd1,
command=('sudocmd_mod', [sudocmd1], dict(description=u'Nope')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
dict(
desc='Try to delete non-existent %r' % sudocmd1,
command=('sudocmd_del', [sudocmd1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
@@ -88,7 +91,8 @@ class test_sudocmd(Declarative):
description=u'Test sudo command 1',
),
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(message=u'sudo command with ' +
+ u'name "%s" already exists' % sudocmd1),
),
@@ -175,20 +179,23 @@ class test_sudocmd(Declarative):
dict(
desc='Try to retrieve non-existent %r' % sudocmd1,
command=('sudocmd_show', [sudocmd1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
dict(
desc='Try to update non-existent %r' % sudocmd1,
command=('sudocmd_mod', [sudocmd1], dict(description=u'Nope')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
dict(
desc='Try to delete non-existent %r' % sudocmd1,
command=('sudocmd_del', [sudocmd1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
]
diff --git a/tests/test_xmlrpc/test_sudocmdgroup_plugin.py b/tests/test_xmlrpc/test_sudocmdgroup_plugin.py
index 9f2bf333..2bfbb625 100644
--- a/tests/test_xmlrpc/test_sudocmdgroup_plugin.py
+++ b/tests/test_xmlrpc/test_sudocmdgroup_plugin.py
@@ -107,7 +107,8 @@ class test_sudocmdgroup(Declarative):
dict(
desc='Try to retrieve non-existent %r' % sudocmdgroup1,
command=('sudocmdgroup_show', [sudocmdgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup1),
),
@@ -115,14 +116,16 @@ class test_sudocmdgroup(Declarative):
desc='Try to update non-existent %r' % sudocmdgroup1,
command=('sudocmdgroup_mod', [sudocmdgroup1],
dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup1),
),
dict(
desc='Try to delete non-existent %r' % sudocmdgroup1,
command=('sudocmdgroup_del', [sudocmdgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup1),
),
@@ -154,7 +157,8 @@ class test_sudocmdgroup(Declarative):
'sudocmdgroup_add', [sudocmdgroup1],
dict(description=u'Test desc 1')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(message=u'sudo command group ' +
+ u'with name "%s" already exists' % sudocmdgroup1),
),
@@ -235,7 +239,8 @@ class test_sudocmdgroup(Declarative):
dict(
desc='Try to retrieve non-existent %r' % sudocmdgroup2,
command=('sudocmdgroup_show', [sudocmdgroup2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup2),
),
@@ -243,14 +248,16 @@ class test_sudocmdgroup(Declarative):
desc='Try to update non-existent %r' % sudocmdgroup2,
command=('sudocmdgroup_mod', [sudocmdgroup2],
dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup2),
),
dict(
desc='Try to delete non-existent %r' % sudocmdgroup2,
command=('sudocmdgroup_del', [sudocmdgroup2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup2),
),
@@ -282,7 +289,9 @@ class test_sudocmdgroup(Declarative):
'sudocmdgroup_add', [sudocmdgroup2],
dict(description=u'Test desc 2')
),
- expected=errors.DuplicateEntry(),
+ expected=errors.DuplicateEntry(
+ message=u'sudo command group with name "%s" already exists' %
+ sudocmdgroup2),
),
@@ -562,14 +571,16 @@ class test_sudocmdgroup(Declarative):
dict(
desc='Try to delete non-existent %r' % sudocmdgroup1,
command=('sudocmdgroup_del', [sudocmdgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup1),
),
dict(
desc='Try to retrieve non-existent %r' % sudocmdgroup1,
command=('sudocmdgroup_show', [sudocmdgroup1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup1),
),
@@ -577,7 +588,8 @@ class test_sudocmdgroup(Declarative):
desc='Try to update non-existent %r' % sudocmdgroup1,
command=('sudocmdgroup_mod', [sudocmdgroup1],
dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup1),
),
@@ -597,14 +609,16 @@ class test_sudocmdgroup(Declarative):
dict(
desc='Try to delete non-existent %r' % sudocmdgroup2,
command=('sudocmdgroup_del', [sudocmdgroup2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup2),
),
dict(
desc='Try to retrieve non-existent %r' % sudocmdgroup2,
command=('sudocmdgroup_show', [sudocmdgroup2], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup2),
),
@@ -612,7 +626,8 @@ class test_sudocmdgroup(Declarative):
desc='Try to update non-existent %r' % sudocmdgroup2,
command=('sudocmdgroup_mod', [sudocmdgroup2],
dict(description=u'Foo')),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command group not found' % sudocmdgroup2),
),
@@ -632,7 +647,8 @@ class test_sudocmdgroup(Declarative):
dict(
desc='Verify that %r is really gone' % sudocmd1,
command=('sudocmd_show', [sudocmd1], {}),
- expected=errors.NotFound(reason='no such entry'),
+ expected=errors.NotFound(
+ reason=u'%s: sudo command not found' % sudocmd1),
),
]
diff --git a/tests/test_xmlrpc/test_user_plugin.py b/tests/test_xmlrpc/test_user_plugin.py
index 3fcd10a1..53776810 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'),
),
diff --git a/tests/test_xmlrpc/xmlrpc_test.py b/tests/test_xmlrpc/xmlrpc_test.py
index 28f5fac7..c279107b 100644
--- a/tests/test_xmlrpc/xmlrpc_test.py
+++ b/tests/test_xmlrpc/xmlrpc_test.py
@@ -282,10 +282,8 @@ class Declarative(XMLRPC_test):
# information through the exception, so we can't test the kw on the
# client side. However, if we switch to using JSON-RPC for the default
# transport, the exception is a free-form data structure (dict).
-# if e.kw != expected.kw:
-# raise AssertionError(
-# KWARGS % (cmd, name, args, options, expected.kw, e.kw)
-# )
+ # For now just compare the strings
+ assert_deepequal(expected.strerror, e.strerror)
def check_output(self, nice, cmd, args, options, expected, extra_check):
got = api.Command[cmd](*args, **options)