blob: 852a31afde4169c8283a8b00713e780ff601384e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# Blackbox tests for "samba_dnsupdate" command
# Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2011
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2015
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import samba.tests
class SambaDnsUpdateTests(samba.tests.BlackboxTestCase):
"""Blackbox test case for samba_dnsupdate."""
def setUp(self):
self.server_ip = samba.tests.env_get_var_value("DNS_SERVER_IP")
super(SambaDnsUpdateTests, self).setUp()
try:
out = self.check_output("samba_dnsupdate --verbose")
self.assertTrue("Looking for DNS entry" in out)
except samba.tests.BlackboxProcessError:
pass
def test_samba_dnsupate_no_change(self):
out = self.check_output("samba_dnsupdate --verbose")
self.assertTrue("No DNS updates needed" in out)
def test_samba_dnsupate_set_ip(self):
try:
out = self.check_output("samba_dnsupdate --verbose --current-ip=10.0.0.1")
self.assertTrue(" DNS updates and" in out)
self.assertTrue(" DNS deletes needed" in out)
except samba.tests.BlackboxProcessError:
pass
try:
out = self.check_output("samba_dnsupdate --verbose --use-nsupdate --current-ip=10.0.0.1")
except samba.tests.BlackboxProcessError:
self.fail("Error calling samba_dnsupdate")
self.assertTrue("No DNS updates needed" in out)
try:
out = self.check_output("samba_dnsupdate --verbose --use-samba-tool --rpc-server-ip=%s" % self.server_ip)
except samba.tests.BlackboxProcessError:
self.fail("Error calling samba_dnsupdate")
self.assertTrue(" DNS updates and" in out)
self.assertTrue(" DNS deletes needed" in out)
out = self.check_output("samba_dnsupdate --verbose")
self.assertTrue("No DNS updates needed" in out)
|