output = sys.stdout.getvalue()
self.assertIn(expected, output)
- @mock.patch("os.path.isfile", side_effect=[True] + [False] * 10)
+ @mock.patch("os.path.isfile", side_effect=[True] + [False] * 11)
@mock.patch("subprocess.call", return_value=0)
def test_flush_posix(self, *_):
with self.mock_property("platform.system") as obj:
output = sys.stdout.getvalue()
self.assertIn(expected, output)
- @mock.patch("os.path.isfile", side_effect=[True] + [False] * 10)
+ @mock.patch("os.path.isfile", side_effect=[True] + [False] * 11)
@mock.patch("subprocess.call", return_value=1)
def test_flush_posix_fail(self, *_):
with self.mock_property("platform.system") as obj:
output = sys.stdout.getvalue()
self.assertIn(expected, output)
- @mock.patch("os.path.isfile", side_effect=[True, False,
+ @mock.patch("os.path.isfile", side_effect=[True, False, False,
True] + [False] * 10)
@mock.patch("subprocess.call", side_effect=[1, 0])
def test_flush_posix_fail_then_succeed(self, *_):
else:
print_success(nscd_msg.format(result="succeeded"))
+ centos_file = "/etc/init.d/network"
+ centos_msg = "Flushing the DNS cache by restarting network {result}"
+
+ if os.path.isfile(centos_file):
+ if subprocess.call(SUDO + [centos_file, "restart"]):
+ print_failure(centos_msg.format(result="failed"))
+ else:
+ print_success(centos_msg.format(result="succeeded"))
+
system_prefixes = ["/usr", ""]
service_types = ["NetworkManager", "wicd", "dnsmasq", "networking"]