wbclient: Check with nss_wrapper_enabled().
[Samba.git] / python / samba / tests / param.py
blobf539eba140dcfb7f3252ee8d30c77ae301aad0b9
1 # Unix SMB/CIFS implementation.
2 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
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.param."""
20 from samba import param
21 import samba.tests
23 class LoadParmTestCase(samba.tests.TestCase):
25 def test_init(self):
26 file = param.LoadParm()
27 self.assertTrue(file is not None)
29 def test_length(self):
30 file = param.LoadParm()
31 self.assertEquals(0, len(file))
33 def test_set_workgroup(self):
34 file = param.LoadParm()
35 file.set("workgroup", "bla")
36 self.assertEquals("BLA", file.get("workgroup"))
38 def test_is_mydomain(self):
39 file = param.LoadParm()
40 file.set("workgroup", "bla")
41 self.assertTrue(file.is_mydomain("BLA"))
42 self.assertFalse(file.is_mydomain("FOOBAR"))
44 def test_is_myname(self):
45 file = param.LoadParm()
46 file.set("netbios name", "bla")
47 self.assertTrue(file.is_myname("BLA"))
48 self.assertFalse(file.is_myname("FOOBAR"))
50 def test_load_default(self):
51 file = param.LoadParm()
52 file.load_default()
54 def test_section_nonexistent(self):
55 samba_lp = param.LoadParm()
56 samba_lp.load_default()
57 self.assertRaises(KeyError, samba_lp.__getitem__, "nonexistent")