Ejemplo n.º 1
0
def status():
    status_cmd = StatusCommand({})
    status_cmd.config = {'name': 'app', 'namespace': 'namespace'}

    with catch_stdout() as caught_output:
        status_cmd.action()
        output = caught_output.getvalue()
    return output
Ejemplo n.º 2
0
def status(count=1, catch_exception=None):
    status_cmd = StatusCommand({'<count>': count})
    status_cmd.config = {'name': 'app', 'namespace': 'namespace'}

    with catch_stdout() as caught_output:
        with conditional(catch_exception, pytest.raises(catch_exception)):
            status_cmd.action()
        output = caught_output.getvalue()
    return output
Ejemplo n.º 3
0
def test_status_no_deploy(init_mock, open_mock, isfile_mock):
    """
    Tests calling the status command before the app has been deployed.
    """
    isfile_mock.return_value = False
    status = StatusCommand({})

    with catch_stdout() as caught_output:
        with pytest.raises(SystemExit):
            status.action()
        output = caught_output.getvalue()
        expected_output = "This application has not been deployed yet."
        assert expected_output in output
Ejemplo n.º 4
0
def test_uninitialized_status():
    """
    Tests calling the status command before the app has been initialized.
    """
    with catch_stdout() as caught_output:
        with pytest.raises(SystemExit):
            StatusCommand({})
        output = caught_output.getvalue()
        expected_error = "This command requires you to be in an `mlt init` " \
                         "built directory"
        assert expected_error in output