diff --git a/scripts/TouchinBuild/Tests/UnitTests/ShellCommand/__init__.py b/scripts/TouchinBuild/Tests/UnitTests/ShellCommand/__init__.py new file mode 100644 index 0000000..cc31abc --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/ShellCommand/__init__.py @@ -0,0 +1 @@ +__author__ = 'rzaitov' diff --git a/scripts/TouchinBuild/Tests/UnitTests/ShellCommand/test_shellCommand.py b/scripts/TouchinBuild/Tests/UnitTests/ShellCommand/test_shellCommand.py new file mode 100644 index 0000000..34be057 --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/ShellCommand/test_shellCommand.py @@ -0,0 +1,24 @@ +import unittest +from commands.ShellCommandBase import ShellCommandBase + + +class MyShellCommand(ShellCommandBase): + def __init__(self, execWithError=False): + ShellCommandBase.__init__(self) + self.execWithError = execWithError + + def execute(self): + cmdText = 'exit 1' if self.execWithError else 'exit 0' + self.executeShell(cmdText) + + +class TestShellCommand(unittest.TestCase): + def test_noError(self): + cmd = MyShellCommand(execWithError=False) + cmd.execute() + + def test_withError(self): + cmd = MyShellCommand(execWithError=True) + + with self.assertRaises(Exception): + cmd.execute() \ No newline at end of file