diff options
author | Tim Potter <tpot@samba.org> | 2006-04-30 01:08:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:05:23 -0500 |
commit | 5abd8940f9bcfbab1b68018759a2405ec944f831 (patch) | |
tree | 06ea76e67a8382d48ec0ed82da1e0c124cec6721 /source4/scripting | |
parent | ec4421d126fd69d3caa51d89651b4f5f13d097ca (diff) | |
download | samba-5abd8940f9bcfbab1b68018759a2405ec944f831.tar.gz samba-5abd8940f9bcfbab1b68018759a2405ec944f831.tar.bz2 samba-5abd8940f9bcfbab1b68018759a2405ec944f831.zip |
r15348: Start adding a dict interface and tests to LdbMessage class.
(This used to be commit 7e30e8ba57efe37314ebca02f964420f56b9eb52)
Diffstat (limited to 'source4/scripting')
-rwxr-xr-x | source4/scripting/swig/torture/torture_ldb.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source4/scripting/swig/torture/torture_ldb.py b/source4/scripting/swig/torture/torture_ldb.py index c9a3ded6da..311a2b1d66 100755 --- a/source4/scripting/swig/torture/torture_ldb.py +++ b/source4/scripting/swig/torture/torture_ldb.py @@ -1,14 +1,18 @@ #!/usr/bin/python -import Ldb +import Ldb, sys -def fail(msg): - print 'FAILED:', msg - sys.exit(1) +def test(cond, msg): + if not cond: + print 'FAILED:', msg + sys.exit(1) -l = Ldb.Ldb() +# Torture LdbMessage -l.connect('tdb:///tmp/foo.ldb') -result = l.search('(dn=*)') +m = Ldb.LdbMessage() +m['animal'] = 'dog' +m['name'] = 'spotty' -print result +test(m.keys() == ['animal', 'name'], 'keys() test failed') +test(m.values() == [['dog'], ['spotty']], 'values() test failed') +test(m.items() == [('animal', ['dog']), ('name', ['spotty'])], 'items() test failed') |