Ejemplo n.º 1
0
def test_execute_command_should_fail():
    try:
        actual_res = utils.execute_command(['ls', '--help-does-not-exist'])
    except subprocess.CalledProcessError as e:
        assert True, "Expected exception thrown."
    else:
        assert False, "Unexpected exception (or no exception) thrown"
Ejemplo n.º 2
0
def test_execute_command_should_succeed():
    actual_res = utils.execute_command(['ls', '--help'])
    assert actual_res == 0, actual_res
Ejemplo n.º 3
0
    def test_execute_command(self):
        actual_res = utils.execute_command(['ls', '--help'])
        self.assertEquals(actual_res, 0, actual_res)

        actual_res = utils.execute_command(['ls', '--help-does-not-exist'])
        self.assertEquals(actual_res, 2, actual_res)