Add uts for parse_command

Change-Id: I8d1393f4d8bc39d14047517317a43fedca84a6d9
This commit is contained in:
00129207 2017-07-18 10:15:12 +08:00
parent 5d92a6bfac
commit fa50c1a7dc

View File

@ -244,3 +244,21 @@ class ParseNetsTest(test_utils.BaseTestCase):
nets = ['network=1234567, v4-fixed-ip=23.555.567,789']
self.assertRaises(exc.CommandError,
utils.parse_nets, nets)
class ParseCommandTest(test_utils.BaseTestCase):
def test_no_command(self):
command = []
result = utils.parse_command(command)
self.assertEqual('', result)
def test_command_ls(self):
command = ['ls', '-al']
result = utils.parse_command(command)
self.assertEqual('"ls" "-al"', result)
def test_command_echo_hello(self):
command = ['sh', '-c', 'echo hello']
result = utils.parse_command(command)
self.assertEqual('"sh" "-c" "echo hello"', result)