Add basic test for Utils.check_output()

This commit is contained in:
Till Maas 2018-05-23 01:45:34 +02:00
parent 83f2521d5e
commit 0bb66af883

View file

@ -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