summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-20 16:45:32 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-20 16:45:32 -0600
commitbb978e591b08b3388345c848fb866c22239094ac (patch)
tree9aa58fb1c3e859bd9331f60b7936f48e00855758 /tests
parentd615e4dafb9c4f3d737143f826ed20be918317fe (diff)
downloadfreeipa-bb978e591b08b3388345c848fb866c22239094ac.tar.gz
freeipa-bb978e591b08b3388345c848fb866c22239094ac.tar.xz
freeipa-bb978e591b08b3388345c848fb866c22239094ac.zip
Fixed bug in DefaultFrom where impleied keys were using entire func_code.co_varnames instead of an approprate slice
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ipalib/test_frontend.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py
index 7760ffbe3..966b5e935 100644
--- a/tests/test_ipalib/test_frontend.py
+++ b/tests/test_ipalib/test_frontend.py
@@ -115,11 +115,21 @@ class test_DefaultFrom(ClassChecker):
kw_copy = dict(kw)
del kw_copy[key]
assert o(**kw_copy) is None
+
+ # Test using implied keys:
o = self.cls(lambda first, last: first[0] + last)
assert o(first='john', last='doe') == 'jdoe'
assert o(first='', last='doe') is None
assert o(one='john', two='doe') is None
+ # Test that co_varnames slice is used:
+ def callback2(first, last):
+ letter = first[0]
+ return letter + last
+ o = self.cls(callback2)
+ assert o.keys == ('first', 'last')
+ assert o(first='john', last='doe') == 'jdoe'
+
def test_parse_param_spec():
"""