# Path: shpkpr/cli/entrypoint.py
# @click.command(cls=ShpkprCLI, context_settings=CONTEXT_SETTINGS)
# def cli():
#     """A tool to manage applications running on Marathon."""
#     logger.configure()


import json
import responses
import yaml
from click.testing import CliRunner
from shpkpr.cli.entrypoint import cli

# local imports


def test_no_args():
    runner = CliRunner()
    result = runner.invoke(cli, ['apps', 'show'])

    assert result.exit_code == 2
    assert 'Usage:' in result.output


def test_help():
    runner = CliRunner()
    result = runner.invoke(cli, ['apps', 'show', '--help'])

    assert result.exit_code == 0
    assert 'Usage:' in result.output
    assert 'Show detailed information for one or more applications.' in result.output


@responses.activate
def test_show_single_app(runner, json_fixture):
    responses.add(responses.GET,
                  'http://marathon.somedomain.com:8080/v2/apps/test-app',
                  status=200,
                  json=json_fixture("valid_app"))

    result = runner(['apps', 'show'], env={
        'SHPKPR_MARATHON_URL': "http://marathon.somedomain.com:8080",

# Path: shpkpr/cli/entrypoint.py
# @click.command(cls=ShpkprCLI, context_settings=CONTEXT_SETTINGS)
# def cli():
#     """A tool to manage applications running on Marathon."""
#     logger.configure()


# Path: tests/commands/test_cmd_apps_show.py
import json
import responses
import yaml
from click.testing import CliRunner
from shpkpr.cli.entrypoint import cli


# local imports


def test_no_args():
    runner = CliRunner()
    result = runner.invoke(cli, ['apps', 'show'])

    assert result.exit_code == 2
    assert 'Usage:' in result.output


def test_help():
    runner = CliRunner()
    result = runner.invoke(cli, ['apps', 'show', '--help'])

    assert result.exit_code == 0
    assert 'Usage:' in result.output
    assert 'Show detailed information for one or more applications.' in result.output


@responses.activate
def test_show_single_app(runner, json_fixture):
    responses.add(responses.GET,
                  'http://marathon.somedomain.com:8080/v2/apps/test-app',
                  status=200,
                  json=json_fixture("valid_app"))

    result = runner(['apps', 'show'], env={
        'SHPKPR_MARATHON_URL': "http://marathon.somedomain.com:8080",

        'SHPKPR_APPLICATION': 'test-app',