#!/usr/bin/python # Simple tests for the ldb python bindings. # Copyright (C) 2007 Jelmer Vernooij import sys import unittest # Required for the standalone LDB build sys.path.append("swig") sys.path.append("build/lib.linux-i686-2.4") import ldb class NoContextTests(unittest.TestCase): def test_valid_attr_name(self): self.assertTrue(ldb.valid_attr_name("foo")) self.assertFalse(ldb.valid_attr_name("24foo")) def test_timestring(self): self.assertEquals("19700101000000.0Z", ldb.timestring(0)) self.assertEquals("20071119191012.0Z", ldb.timestring(1195499412)) def test_string_to_time(self): self.assertEquals(0, ldb.string_to_time("19700101000000.0Z")) self.assertEquals(1195499412, ldb.string_to_time("20071119191012.0Z")) class SimpleLdb(unittest.TestCase): def test_connect(self): ldb.Ldb("foo.tdb") def test_connect_none(self): ldb.Ldb() def test_connect_later(self): x = ldb.Ldb() x.connect("foo.tdb") def test_repr(self): x = ldb.Ldb() self.assertTrue(repr(x).startswith("