Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/lib/tdb/python/tdbdump.py

    r414 r745  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# Trivial reimplementation of tdbdump in Python
    33
  • trunk/server/lib/tdb/python/tests/simple.py

    r414 r745  
    1 #!/usr/bin/python
     1#!/usr/bin/env python
    22# Some simple tests for the Python bindings for TDB
    33# Note that this tests the interface of the Python bindings
     
    1313
    1414class OpenTdbTests(TestCase):
     15
    1516    def test_nonexistant_read(self):
    16         self.assertRaises(IOError, tdb.Tdb, "/some/nonexistant/file", 0, tdb.DEFAULT, os.O_RDWR)
     17        self.assertRaises(IOError, tdb.Tdb, "/some/nonexistant/file", 0,
     18                tdb.DEFAULT, os.O_RDWR)
    1719
    1820class CloseTdbTests(TestCase):
     21
    1922    def test_double_close(self):
    20         self.tdb = tdb.Tdb(tempfile.mkstemp()[1], 0, tdb.DEFAULT, os.O_CREAT|os.O_RDWR)
     23        self.tdb = tdb.Tdb(tempfile.mkstemp()[1], 0, tdb.DEFAULT,
     24                os.O_CREAT|os.O_RDWR)
    2125        self.assertNotEqual(None, self.tdb)
    2226
     
    2630
    2731
     32class InternalTdbTests(TestCase):
     33
     34    def test_repr(self):
     35        self.tdb = tdb.Tdb()
     36
     37        # repr used to crash on internal db
     38        self.assertEquals(repr(self.tdb), "Tdb(<internal>)")
     39
     40
    2841class SimpleTdbTests(TestCase):
     42
    2943    def setUp(self):
    3044        super(SimpleTdbTests, self).setUp()
    31         self.tdb = tdb.Tdb(tempfile.mkstemp()[1], 0, tdb.DEFAULT, os.O_CREAT|os.O_RDWR)
     45        self.tdb = tdb.Tdb(tempfile.mkstemp()[1], 0, tdb.DEFAULT,
     46                os.O_CREAT|os.O_RDWR)
    3247        self.assertNotEqual(None, self.tdb)
    3348
     
    8297        self.tdb.map_size
    8398
     99    def test_freelist_size(self):
     100        self.tdb.freelist_size
     101
    84102    def test_name(self):
    85103        self.tdb.filename
     
    104122        self.assertEquals("1", self.tdb["bloe"])
    105123
    106     def test_iterator(self):
     124    def test_transaction_prepare_commit(self):
    107125        self.tdb["bloe"] = "2"
    108         self.tdb["bla"] = "hoi"
    109         i = iter(self.tdb)
    110         self.assertEquals(set(["bloe", "bla"]), set([i.next(), i.next()]))
     126        self.tdb.transaction_start()
     127        self.tdb["bloe"] = "1"
     128        self.tdb.transaction_prepare_commit()
     129        self.tdb.transaction_commit()
     130        self.assertEquals("1", self.tdb["bloe"])
    111131
    112132    def test_iterkeys(self):
     
    123143        self.assertEquals(0, len(list(self.tdb)))
    124144
     145    def test_repack(self):
     146        self.tdb["foo"] = "abc"
     147        self.tdb["bar"] = "def"
     148        del self.tdb["foo"]
     149        self.tdb.repack()
     150
     151    def test_seqnum(self):
     152        self.tdb.enable_seqnum()
     153        seq1 = self.tdb.seqnum
     154        self.tdb.increment_seqnum_nonblock()
     155        seq2 = self.tdb.seqnum
     156        self.assertEquals(seq2-seq1, 1)
     157
    125158    def test_len(self):
    126159        self.assertEquals(0, len(list(self.tdb)))
     
    128161        self.assertEquals(1, len(list(self.tdb)))
    129162
     163    def test_add_flags(self):
     164        self.tdb.add_flags(tdb.NOMMAP)
     165        self.tdb.remove_flags(tdb.NOMMAP)
     166
     167
     168class VersionTests(TestCase):
     169
     170    def test_present(self):
     171        self.assertTrue(isinstance(tdb.__version__, str))
     172
    130173
    131174if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.