git.samba.org
/
samba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r15348: Start adding a dict interface and tests to LdbMessage class.
[samba.git]
/
source
/
scripting
/
swig
/
torture
/
torture_ldb.py
diff --git
a/source/scripting/swig/torture/torture_ldb.py
b/source/scripting/swig/torture/torture_ldb.py
index c9a3ded6dabc571e8fbe514c0e128ba7cc23fbf8..311a2b1d668704723b202b550f5947c7a6ecff83 100755
(executable)
--- a/
source/scripting/swig/torture/torture_ldb.py
+++ b/
source/scripting/swig/torture/torture_ldb.py
@@
-1,14
+1,18
@@
#!/usr/bin/python
#!/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')