1 # Unix SMB/CIFS implementation.
2 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
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.
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.
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/>.
18 """Tests for samba.dcerpc.registry."""
20 from samba
.dcerpc
import winreg
21 from samba
.tests
import RpcInterfaceTestCase
24 class WinregTests(RpcInterfaceTestCase
):
28 self
.conn
= winreg
.winreg("ncalrpc:", self
.get_loadparm(),
29 self
.get_credentials())
32 return self
.conn
.OpenHKLM(None,
33 winreg
.KEY_QUERY_VALUE | winreg
.KEY_ENUMERATE_SUB_KEYS
)
36 handle
= self
.conn
.OpenHKLM(None,
37 winreg
.KEY_QUERY_VALUE | winreg
.KEY_ENUMERATE_SUB_KEYS
)
38 self
.conn
.CloseKey(handle
)
40 def test_getversion(self
):
41 handle
= self
.get_hklm()
42 version
= self
.conn
.GetVersion(handle
)
43 self
.assertEqual(int, version
.__class
__)
44 self
.conn
.CloseKey(handle
)
46 def test_getkeyinfo(self
):
47 handle
= self
.conn
.OpenHKLM(None,
48 winreg
.KEY_QUERY_VALUE | winreg
.KEY_ENUMERATE_SUB_KEYS
)
49 x
= self
.conn
.QueryInfoKey(handle
, winreg
.String())
50 self
.assertEqual(9, len(x
)) # should return a 9-tuple
51 self
.conn
.CloseKey(handle
)