r15348: Start adding a dict interface and tests to LdbMessage class.
[samba.git] / source / scripting / swig / torture / torture_ldb.py
1 #!/usr/bin/python
2
3 import Ldb, sys
4
5 def test(cond, msg):
6     if not cond:
7         print 'FAILED:', msg
8         sys.exit(1)
9
10 # Torture LdbMessage
11
12 m = Ldb.LdbMessage()
13 m['animal'] = 'dog'
14 m['name'] = 'spotty'
15
16 test(m.keys() == ['animal', 'name'], 'keys() test failed')
17 test(m.values() == [['dog'], ['spotty']], 'values() test failed')
18 test(m.items() == [('animal', ['dog']), ('name', ['spotty'])], 'items() test failed')