samba.tests.provision: Remove broken become_dc test.
[Samba/fernandojvsilva.git] / source4 / scripting / python / samba / tests / provision.py
blobf34073504c063fb4032bff348ec3d7e8567f32ad
1 #!/usr/bin/python
3 # Unix SMB/CIFS implementation.
4 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
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.
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 import os
21 from samba.provision import setup_secretsdb, findnss
22 import samba.tests
23 from ldb import Dn
24 from samba import param
25 import unittest
27 lp = samba.tests.cmdline_loadparm
29 setup_dir = "setup"
30 def setup_path(file):
31 return os.path.join(setup_dir, file)
34 class ProvisionTestCase(samba.tests.TestCaseInTempDir):
35 """Some simple tests for individual functions in the provisioning code.
36 """
37 def test_setup_secretsdb(self):
38 path = os.path.join(self.tempdir, "secrets.ldb")
39 ldb = setup_secretsdb(path, setup_path, None, None, lp=lp)
40 try:
41 self.assertEquals("LSA Secrets",
42 ldb.searchone(basedn="CN=LSA Secrets", attribute="CN"))
43 finally:
44 del ldb
45 os.unlink(path)
48 class FindNssTests(unittest.TestCase):
49 """Test findnss() function."""
50 def test_nothing(self):
51 def x(y):
52 raise KeyError
53 self.assertRaises(KeyError, findnss, x, [])
55 def test_first(self):
56 self.assertEquals("bla", findnss(lambda x: "bla", ["bla"]))
58 def test_skip_first(self):
59 def x(y):
60 if y != "bla":
61 raise KeyError
62 return "ha"
63 self.assertEquals("ha", findnss(x, ["bloe", "bla"]))
66 class Disabled(object):
67 def test_setup_templatesdb(self):
68 raise NotImplementedError(self.test_setup_templatesdb)
70 def test_setup_registry(self):
71 raise NotImplementedError(self.test_setup_registry)
73 def test_setup_samdb_rootdse(self):
74 raise NotImplementedError(self.test_setup_samdb_rootdse)
76 def test_setup_samdb_partitions(self):
77 raise NotImplementedError(self.test_setup_samdb_partitions)
79 def test_create_phpldapadmin_config(self):
80 raise NotImplementedError(self.test_create_phpldapadmin_config)
82 def test_provision_dns(self):
83 raise NotImplementedError(self.test_provision_dns)
85 def test_provision_ldapbase(self):
86 raise NotImplementedError(self.test_provision_ldapbase)
88 def test_provision_guess(self):
89 raise NotImplementedError(self.test_provision_guess)
91 def test_join_domain(self):
92 raise NotImplementedError(self.test_join_domain)
94 def test_vampire(self):
95 raise NotImplementedError(self.test_vampire)
97 def test_erase_partitions(self):
98 raise NotImplementedError(self.test_erase_partitions)