s4-python: Add some more module docstrings.
[Samba/gebeck_regimport.git] / source4 / scripting / python / samba / tests / param.py
blob7848e1c23b6e70977802dc40011f2e9f88ea3e0f
1 #!/usr/bin/env python
3 # Unix SMB/CIFS implementation.
4 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
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.
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.
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/>.
20 """Tests for samba.param."""
22 from samba import param
23 import samba.tests
25 class LoadParmTestCase(samba.tests.TestCase):
27 def test_init(self):
28 file = param.LoadParm()
29 self.assertTrue(file is not None)
31 def test_length(self):
32 file = param.LoadParm()
33 self.assertEquals(0, len(file))
35 def test_set_workgroup(self):
36 file = param.LoadParm()
37 file.set("workgroup", "bla")
38 self.assertEquals("BLA", file.get("workgroup"))
40 def test_is_mydomain(self):
41 file = param.LoadParm()
42 file.set("workgroup", "bla")
43 self.assertTrue(file.is_mydomain("BLA"))
44 self.assertFalse(file.is_mydomain("FOOBAR"))
46 def test_is_myname(self):
47 file = param.LoadParm()
48 file.set("netbios name", "bla")
49 self.assertTrue(file.is_myname("BLA"))
50 self.assertFalse(file.is_myname("FOOBAR"))
52 def test_load_default(self):
53 file = param.LoadParm()
54 file.load_default()
56 def test_section_nonexistant(self):
57 samba_lp = param.LoadParm()
58 samba_lp.load_default()
59 self.assertRaises(KeyError, samba_lp.__getitem__, "nonexistant")