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."""
25 from cStringIO import StringIO
27 from selftest.tests import TestCase
29 from selftest.target.samba import (
37 class BinDirPathTests(TestCase):
39 def test_mapping(self):
40 self.assertEquals("exe4",
41 bindir_path({"exe": "exe4"}, "/some/path", "exe"))
42 self.assertEquals("/bin/ls",
43 bindir_path({"exe": "ls"}, "/bin", "exe"))
45 def test_no_mapping(self):
46 self.assertEqual("exe", bindir_path({}, "/some/path", "exe"))
47 self.assertEqual("/bin/ls",
48 bindir_path({}, "/bin", "ls"))
51 class MkRealmsStanzaTests(TestCase):
55 mk_realms_stanza("rijk", "dnsnaam", "domein", "ipv4_kdc"),
59 admin_server = ipv4_kdc:88
60 default_domain = dnsnaam
64 admin_server = ipv4_kdc:88
65 default_domain = dnsnaam
69 admin_server = ipv4_kdc:88
70 default_domain = dnsnaam
76 class WriteKrb5ConfTests(TestCase):
78 def test_simple(self):
80 write_krb5_conf(f, "rijk", "dnsnaam", "domein", "kdc_ipv4")
81 self.assertEquals('''\
82 #Generated krb5.conf for rijk
85 \tdefault_realm = rijk
86 \tdns_lookup_realm = false
87 \tdns_lookup_kdc = false
88 \tticket_lifetime = 24h
90 \tallow_weak_crypto = yes
95 admin_server = kdc_ipv4:88
96 default_domain = dnsnaam
100 admin_server = kdc_ipv4:88
101 default_domain = dnsnaam
105 admin_server = kdc_ipv4:88
106 default_domain = dnsnaam