| 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 | from samba import param | 
|---|
| 21 | import unittest | 
|---|
| 22 |  | 
|---|
| 23 | class LoadParmTestCase(unittest.TestCase): | 
|---|
| 24 | def test_init(self): | 
|---|
| 25 | file = param.LoadParm() | 
|---|
| 26 | self.assertTrue(file is not None) | 
|---|
| 27 |  | 
|---|
| 28 | def test_length(self): | 
|---|
| 29 | file = param.LoadParm() | 
|---|
| 30 | self.assertEquals(0, len(file)) | 
|---|
| 31 |  | 
|---|
| 32 | def test_set_workgroup(self): | 
|---|
| 33 | file = param.LoadParm() | 
|---|
| 34 | file.set("workgroup", "bla") | 
|---|
| 35 | self.assertEquals("BLA", file.get("workgroup")) | 
|---|
| 36 |  | 
|---|
| 37 | def test_is_mydomain(self): | 
|---|
| 38 | file = param.LoadParm() | 
|---|
| 39 | file.set("workgroup", "bla") | 
|---|
| 40 | self.assertTrue(file.is_mydomain("BLA")) | 
|---|
| 41 | self.assertFalse(file.is_mydomain("FOOBAR")) | 
|---|
| 42 |  | 
|---|
| 43 | def test_is_myname(self): | 
|---|
| 44 | file = param.LoadParm() | 
|---|
| 45 | file.set("netbios name", "bla") | 
|---|
| 46 | self.assertTrue(file.is_myname("BLA")) | 
|---|
| 47 | self.assertFalse(file.is_myname("FOOBAR")) | 
|---|
| 48 |  | 
|---|
| 49 | def test_load_default(self): | 
|---|
| 50 | file = param.LoadParm() | 
|---|
| 51 | file.load_default() | 
|---|
| 52 |  | 
|---|