# Path: tests/fixture_data.py
# PROJECT_DATA = {
#     'id': '000',
#     'name': 'nyan',
#     'description': 'nyan',
#     'owner': 1,
#     'ctime': '2016-12-16T12:25:52.718310Z',
#     'mtime': '2017-01-20T14:35:02.196871Z',
#     'urls': {
#         'display': 'https://app.valohai.com/p/nyan/nyan/',
#     }
# }
# 
# Path: valohai_cli/commands/project/status.py
# @click.command()
# @click.option('--summary/--no-summary', default=True, help='Show execution summary')
# @click.option('--incomplete/--no-incomplete', default=True, help='Show details of incomplete executions')
# def status(summary: bool, incomplete: bool) -> None:
#     """
#     Get the general status of the linked project
#     """
#     project = get_project(require=True)
#     project_data = request('get', f'/api/v0/projects/{project.id}/').json()
# 
#     click.secho(f'# Project {click.style(project.name, underline=True)}', bold=True)
#     if 'urls' in project_data:
#         click.secho(f"  {project_data['urls']['display']}")
#     click.secho('')
# 
#     if summary:
#         print_execution_summary(project_data)
#     if incomplete:
#         print_incomplete_executions(project)


import requests_mock
from tests.fixture_data import PROJECT_DATA
from valohai_cli.commands.project.status import status



def test_status(runner, logged_in_and_linked):
    with requests_mock.mock() as m:
        project_data = dict(
            PROJECT_DATA,
            execution_summary={
                'count': 10,
            }
        )
        m.get(f"https://app.valohai.com/api/v0/projects/{project_data['id']}/", json=project_data)
        m.get('https://app.valohai.com/api/v0/executions/', json={'results': []})

# Path: tests/fixture_data.py
# PROJECT_DATA = {
#     'id': '000',
#     'name': 'nyan',
#     'description': 'nyan',
#     'owner': 1,
#     'ctime': '2016-12-16T12:25:52.718310Z',
#     'mtime': '2017-01-20T14:35:02.196871Z',
#     'urls': {
#         'display': 'https://app.valohai.com/p/nyan/nyan/',
#     }
# }
# 
# Path: valohai_cli/commands/project/status.py
# @click.command()
# @click.option('--summary/--no-summary', default=True, help='Show execution summary')
# @click.option('--incomplete/--no-incomplete', default=True, help='Show details of incomplete executions')
# def status(summary: bool, incomplete: bool) -> None:
#     """
#     Get the general status of the linked project
#     """
#     project = get_project(require=True)
#     project_data = request('get', f'/api/v0/projects/{project.id}/').json()
# 
#     click.secho(f'# Project {click.style(project.name, underline=True)}', bold=True)
#     if 'urls' in project_data:
#         click.secho(f"  {project_data['urls']['display']}")
#     click.secho('')
# 
#     if summary:
#         print_execution_summary(project_data)
#     if incomplete:
#         print_incomplete_executions(project)


# Path: tests/commands/project/test_status.py
import requests_mock
from tests.fixture_data import PROJECT_DATA
from valohai_cli.commands.project.status import status




def test_status(runner, logged_in_and_linked):
    with requests_mock.mock() as m:
        project_data = dict(
            PROJECT_DATA,
            execution_summary={
                'count': 10,
            }
        )
        m.get(f"https://app.valohai.com/api/v0/projects/{project_data['id']}/", json=project_data)
        m.get('https://app.valohai.com/api/v0/executions/', json={'results': []})

        runner.invoke(status, catch_exceptions=False)