예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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)