summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-11-04 09:41:48 -0500
committerJason Gerard DeRose <jderose@redhat.com>2009-11-17 09:36:38 -0700
commit680bf7c54863452263b9cd324ede444fd438436d (patch)
tree2f81be6443cb44d5bb4c37237001399d79f52414 /tests
parent1d1d82fda4c499f16ec1d74d8b9b63e03ecae144 (diff)
downloadfreeipa-680bf7c54863452263b9cd324ede444fd438436d.tar.gz
freeipa-680bf7c54863452263b9cd324ede444fd438436d.tar.xz
freeipa-680bf7c54863452263b9cd324ede444fd438436d.zip
_convert_scalar() should throw an error if passed a tuple or list
A parameter needs to have multivalue set in order to work on lists/tuples and even then _convert_scalar() will be sent one value at a time.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ipalib/test_parameters.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_ipalib/test_parameters.py b/tests/test_ipalib/test_parameters.py
index 44286ac07..f6bc66f4e 100644
--- a/tests/test_ipalib/test_parameters.py
+++ b/tests/test_ipalib/test_parameters.py
@@ -923,7 +923,7 @@ class test_Str(ClassChecker):
mthd = o._convert_scalar
for value in (u'Hello', 42, 1.2, unicode_str):
assert mthd(value) == unicode(value)
- bad = [True, 'Hello', (u'Hello',), [42.3], dict(one=1), utf8_bytes]
+ bad = [True, 'Hello', dict(one=1), utf8_bytes]
for value in bad:
e = raises(errors.ConversionError, mthd, value)
assert e.name == 'my_str'
@@ -933,6 +933,12 @@ class test_Str(ClassChecker):
assert e.name == 'my_str'
assert e.index == 18
assert_equal(e.error, u'must be Unicode text')
+ bad = [(u'Hello',), [42.3]]
+ for value in bad:
+ e = raises(errors.ConversionError, mthd, value)
+ assert e.name == 'my_str'
+ assert e.index is None
+ assert_equal(e.error, u'Only one value is allowed')
assert o.convert(None) is None
def test_rule_minlength(self):