summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-05-11 04:00:30 -0400
committerRob Crittenden <rcritten@redhat.com>2012-05-29 00:38:40 -0400
commit51bd68eaf5e2b21ce79f6b848a67f88abe9f7e11 (patch)
treef178554d6ac5f5c2e35d3a14827f24dc3fc02017 /tests
parent1af36da933cd3c788e3a48257e2f5c286e985e22 (diff)
downloadfreeipa-51bd68eaf5e2b21ce79f6b848a67f88abe9f7e11.tar.gz
freeipa-51bd68eaf5e2b21ce79f6b848a67f88abe9f7e11.tar.xz
freeipa-51bd68eaf5e2b21ce79f6b848a67f88abe9f7e11.zip
Provide a better error message when deleting nonexistent attributes
If --delattr is used on an attribute that's not present on an entry, and --{set,add}attr isn't being used on that same attribute, say that there's "no such attribute" instead of "<attribute> does not contain <value>". https://fedorahosted.org/freeipa/ticket/2699
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xmlrpc/test_attr.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_attr.py b/tests/test_xmlrpc/test_attr.py
index 248d21570..8b78c97b4 100644
--- a/tests/test_xmlrpc/test_attr.py
+++ b/tests/test_xmlrpc/test_attr.py
@@ -518,4 +518,37 @@ class test_attr(Declarative):
error='must be an integer'),
),
+ dict(
+ desc='Try deleting bogus attribute',
+ command=('config_mod', [], dict(delattr=u'bogusattribute=xyz')),
+ expected=errors.ValidationError(name='bogusattribute',
+ error='No such attribute on this entry'),
+ ),
+
+ dict(
+ desc='Try deleting empty attribute',
+ command=('config_mod', [],
+ dict(delattr=u'ipaCustomFields=See Also,seealso,false')),
+ expected=errors.ValidationError(name='ipacustomfields',
+ error='No such attribute on this entry'),
+ ),
+
+ dict(
+ desc='Set and delete one value, plus try deleting a missing one',
+ command=('config_mod', [], dict(
+ delattr=[u'ipaCustomFields=See Also,seealso,false',
+ u'ipaCustomFields=Country,c,false'],
+ addattr=u'ipaCustomFields=See Also,seealso,false')),
+ expected=errors.AttrValueNotFound(attr='ipacustomfields',
+ value='Country,c,false'),
+ ),
+
+ dict(
+ desc='Try to delete an operational attribute with --delattr',
+ command=('config_mod', [], dict(
+ delattr=u'creatorsName=cn=directory manager')),
+ expected=errors.DatabaseError(
+ desc='Server is unwilling to perform', info=''),
+ ),
+
]