build: Change bin/default/python -> bin/python symlink to bin/default/python_modules
[nivanova/samba-autobuild/.git] / source4 / scripting / python / samba / tests / registry.py
1 # Unix SMB/CIFS implementation.
2 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17
18 """Tests for samba.registry."""
19
20 import os
21 from samba import registry
22 import samba.tests
23
24 class HelperTests(samba.tests.TestCase):
25
26     def test_predef_to_name(self):
27         self.assertEquals("HKEY_LOCAL_MACHINE",
28                           registry.get_predef_name(0x80000002))
29
30     def test_str_regtype(self):
31         self.assertEquals("REG_DWORD", registry.str_regtype(4))
32
33
34
35 class HiveTests(samba.tests.TestCaseInTempDir):
36
37     def setUp(self):
38         super(HiveTests, self).setUp()
39         self.hive_path = os.path.join(self.tempdir, "ldb_new.ldb")
40         self.hive = registry.open_ldb(self.hive_path)
41
42     def tearDown(self):
43         del self.hive
44         os.unlink(self.hive_path)
45         super(HiveTests, self).tearDown()
46
47     def test_ldb_new(self):
48         self.assertTrue(self.hive is not None)
49
50     #def test_flush(self):
51     #    self.hive.flush()
52
53     #def test_del_value(self):
54     #    self.hive.del_value("FOO")
55
56
57 class RegistryTests(samba.tests.TestCase):
58
59     def test_new(self):
60         self.registry = registry.Registry()