def test_run(self): """ Tests the run of a command. """ if Platform.is_unix(): expected = ["Hello, World!"] actual = list(Command("echo 'Hello, World!'").run()) self.assertEqual(expected, actual)
def test_run_to_stdout(self): """ Tests the run of command. """ if Platform.is_unix(): expected = "Hello, World!\n" Command("echo 'Hello, World!'").run_to_stdout() actual = sys.stdout.getvalue() self.assertEqual(expected, actual)
def test_execute(self): """ Tests the execution of command. """ if Platform.is_unix(): expected = "Hello, World!\n" actual = Command("echo 'Hello, World!'").execute() self.assertEqual(expected, actual) expected = "" actual = Command("printf ''").execute() self.assertEqual(expected, actual)