From aa0b3394ea018d591d36ab2ffe2784bb820b1304 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Thu, 14 Nov 2013 12:59:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D1=8B=20=D0=BD=D0=B0=20=D0=B2=D0=BE?= =?UTF-8?q?=D0=B7=D0=B2=D1=80=D0=B0=D1=89=D0=B0=D0=B5=D0=BC=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20shell=20comm?= =?UTF-8?q?and?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/UnitTests/ShellCommand/__init__.py | 1 + .../ShellCommand/test_shellCommand.py | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 scripts/TouchinBuild/Tests/UnitTests/ShellCommand/__init__.py create mode 100644 scripts/TouchinBuild/Tests/UnitTests/ShellCommand/test_shellCommand.py 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