1 # test_run.py -- Tests for selftest.target.samba
2 # Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; version 3
7 # of the License or (at your option) any later version of
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 """Tests for selftest.target.samba."""
22 from cStringIO import StringIO
24 from selftest.tests import TestCase
26 from selftest.target.samba import (
33 class BinDirPathTests(TestCase):
35 def test_mapping(self):
36 self.assertEquals("exe4",
37 bindir_path({"exe": "exe4"}, "/some/path", "exe"))
38 self.assertEquals("/bin/ls",
39 bindir_path({"exe": "ls"}, "/bin", "exe"))
41 def test_no_mapping(self):
42 self.assertEqual("exe", bindir_path({}, "/some/path", "exe"))
43 self.assertEqual("/bin/ls",
44 bindir_path({}, "/bin", "ls"))
47 class MkRealmsStanzaTests(TestCase):
51 mk_realms_stanza("rijk", "dnsnaam", "domein", "ipv4_kdc"),
55 admin_server = ipv4_kdc:88
56 default_domain = dnsnaam
60 admin_server = ipv4_kdc:88
61 default_domain = dnsnaam
65 admin_server = ipv4_kdc:88
66 default_domain = dnsnaam
72 class WriteKrb5ConfTests(TestCase):
74 def test_simple(self):
76 write_krb5_conf(f, "rijk", "dnsnaam", "domein", "kdc_ipv4")
77 self.assertEquals('''\
78 #Generated krb5.conf for rijk
81 \tdefault_realm = rijk
82 \tdns_lookup_realm = false
83 \tdns_lookup_kdc = false
84 \tticket_lifetime = 24h
86 \tallow_weak_crypto = yes
91 admin_server = kdc_ipv4:88
92 default_domain = dnsnaam
96 admin_server = kdc_ipv4:88
97 default_domain = dnsnaam
101 admin_server = kdc_ipv4:88
102 default_domain = dnsnaam