summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-14 14:04:05 -0700
committerJason Gerard DeRose <jderose@redhat.com>2009-01-14 14:04:05 -0700
commitcd3508bacee20c01640964470b0c623691b3c216 (patch)
tree30fa5e6a779cdbb5937a1dbfb5647aa0e45cc927 /tests
parent79422d048959a7f6a5fff981caf91de924788e85 (diff)
downloadfreeipa-cd3508bacee20c01640964470b0c623691b3c216.tar.gz
freeipa-cd3508bacee20c01640964470b0c623691b3c216.tar.xz
freeipa-cd3508bacee20c01640964470b0c623691b3c216.zip
New Param: added Param.query kwarg for crud operations like Retrieve and Search where criteria should not be validated
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ipalib/test_parameters.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_ipalib/test_parameters.py b/tests/test_ipalib/test_parameters.py
index aeaed2a42..f9e370fe0 100644
--- a/tests/test_ipalib/test_parameters.py
+++ b/tests/test_ipalib/test_parameters.py
@@ -164,6 +164,7 @@ class test_Param(ClassChecker):
assert o.create_default is None
assert o._get_default is None
assert o.autofill is False
+ assert o.query is False
assert o.flags == frozenset()
# Test that ValueError is raised when a kwarg from a subclass
@@ -366,15 +367,21 @@ class test_Param(ClassChecker):
Test the `ipalib.parameters.Param.validate` method.
"""
- # Test with required=True/False:
+ # Test in default state (with no rules, no kwarg):
o = self.cls('my_param')
- assert o.required is True
e = raises(errors2.RequirementError, o.validate, None)
assert e.name == 'my_param'
+
+ # Test with required=False
o = self.cls('my_param', required=False)
assert o.required is False
assert o.validate(None) is None
+ # Test with query=True:
+ o = self.cls('my_param', query=True)
+ assert o.query is True
+ assert o.validate(None) is None
+
# Test with multivalue=True:
o = self.cls('my_param', multivalue=True)
e = raises(TypeError, o.validate, [])