1 | #!/usr/bin/python
|
---|
2 |
|
---|
3 | # Unix SMB/CIFS implementation.
|
---|
4 | # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
|
---|
5 | #
|
---|
6 | # This program is free software; you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation; either version 3 of the License, or
|
---|
9 | # (at your option) any later version.
|
---|
10 | #
|
---|
11 | # This program is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 | #
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
18 | #
|
---|
19 |
|
---|
20 | import os
|
---|
21 | import unittest
|
---|
22 | from samba import registry
|
---|
23 | import samba.tests
|
---|
24 |
|
---|
25 | class HelperTests(unittest.TestCase):
|
---|
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 | def setUp(self):
|
---|
37 | super(HiveTests, self).setUp()
|
---|
38 | self.hive_path = os.path.join(self.tempdir, "ldb_new.ldb")
|
---|
39 | self.hive = registry.open_ldb(self.hive_path)
|
---|
40 |
|
---|
41 | def tearDown(self):
|
---|
42 | del self.hive
|
---|
43 | os.unlink(self.hive_path)
|
---|
44 |
|
---|
45 | def test_ldb_new(self):
|
---|
46 | self.assertTrue(self.hive is not None)
|
---|
47 |
|
---|
48 | #def test_flush(self):
|
---|
49 | # self.hive.flush()
|
---|
50 |
|
---|
51 | #def test_del_value(self):
|
---|
52 | # self.hive.del_value("FOO")
|
---|
53 |
|
---|
54 |
|
---|
55 | class RegistryTests(unittest.TestCase):
|
---|
56 | def test_new(self):
|
---|
57 | self.registry = registry.Registry()
|
---|