From 09de774dcc1a5abc1c8f3a00fdb039aa3c522f52 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Wed, 4 Mar 2020 17:46:36 +0100 Subject: SOPA Initial Commit --- test-cli/test/helpers/syscmd.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'test-cli/test/helpers/syscmd.py') diff --git a/test-cli/test/helpers/syscmd.py b/test-cli/test/helpers/syscmd.py index b579e39..a869bd7 100644 --- a/test-cli/test/helpers/syscmd.py +++ b/test-cli/test/helpers/syscmd.py @@ -10,15 +10,24 @@ class TestSysCommand(unittest.TestCase): __outdata = None __outtofile = False - def __init__(self, testname, testfunc, str_cmd, outtofile = False): + #varlist: str_cmd, outtofile + def __init__(self, testname, testfunc, varlist): """ init """ super(TestSysCommand, self).__init__(testfunc) - self.__str_cmd = str_cmd + if "str_cmd" in varlist: + self.__str_cmd = varlist["str_cmd"] + else: + raise Exception('str_cmd param inside TestSysCommand have been be defined') self.__testname = testname - self.__outtofile = outtofile + if "outtofile" in varlist: + self.__outtofile = varlist["outtofile"] + if self.__outtofile is True: + self.__outfilename = '/tmp/{}.txt'.format(testname) + else: + self.__outtofile = None + self.__outfilename = None self._testMethodDoc = testname - if self.__outtofile is True: - self.__outfilename = '/tmp/{}.txt'.format(testname) + def getName(self): return self.__testname -- cgit v1.1