From 0bb66af883e77b7f4cfb4e874f516752afef9773 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Wed, 23 May 2018 01:45:34 +0200 Subject: [PATCH] Add basic test for Utils.check_output() --- tests/test_network_connections.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_network_connections.py b/tests/test_network_connections.py index 67cb1c9..5207999 100755 --- a/tests/test_network_connections.py +++ b/tests/test_network_connections.py @@ -11,7 +11,7 @@ TESTS_BASEDIR = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(1, os.path.join(TESTS_BASEDIR, "..", "library")) import network_connections as n -from network_connections import SysUtil +from network_connections import SysUtil, Util try: @@ -1880,6 +1880,13 @@ class TestNM(unittest.TestCase): self.assertIsNotNone(connections) +class TestUtils(unittest.TestCase): + def test_check_output(self): + res = Util.check_output(["echo", "test"]) + self.assertEqual(res, "test\n") + self.assertRaises(n.MyError, Util.check_output, ["false"]) + + class TestSysUtils(unittest.TestCase): def test_link_read_permaddress(self): # Manipulate PATH to use ethtool mock script to avoid hard dependency on