import pytest

from jina.enums import RemoteAccessType
from jina.flow import Flow
from jina.parser import set_pea_parser, set_pod_parser
from jina.peapods.pods import BasePod
from jina.peapods.runtimes.remote.ssh import SSHRuntime
from jina.proto import jina_pb2


@pytest.mark.skip('works locally, but until I findout how to mock ssh, this has to be skipped')
def test_ssh_pea():
    p = set_pea_parser().parse_args(['--host', 'pi@172.16.1.110', '--timeout', '5000'])

    with SSHRuntime(p, kind='pea') as pp:
        assert pp.status.envelope.status.code == jina_pb2.StatusProto.READY

    assert pp.status is None


@pytest.mark.skip('works locally, but until I find out how to mock ssh, this has to be skipped')
def test_ssh_pod():
    p = set_pod_parser().parse_args(['--host', 'pi@172.16.1.110', '--timeout', '5000'])
    with SSHRuntime(p, kind='pod') as pp:
        assert pp.status.envelope.status.code == jina_pb2.StatusProto.READY

    assert pp.status is None


@pytest.mark.skip('not implemented yet')
def test_ssh_mutable_pod():
    p = set_pod_parser().parse_args(['--host', 'pi@172.16.1.110', '--timeout', '5000'])
    p = BasePod(p)
    with SSHRuntime(p, kind='pod') as pp:
        assert pp.status.envelope.status.code == jina_pb2.StatusProto.READY

    assert pp.status is None


@pytest.mark.skip('not implemented yet')
def test_flow():
    f = Flow().add().add(host='pi@172.16.1.110', remote_access=RemoteAccessType.SSH)
    with f:
        pass

[(11, 'pytest.mark.skip', 'pytest.mark.skip', (['"""works locally, but until I findout how to mock ssh, this has to be skipped"""'], {}), False, 'import pytest\n'), (21, 'pytest.mark.skip', 'pytest.mark.skip', (['"""works locally, but until I find out how to mock ssh, this has to be skipped"""'], {}), False, 'import pytest\n'), (30, 'pytest.mark.skip', 'pytest.mark.skip', (['"""not implemented yet"""'], {}), False, 'import pytest\n'), (40, 'pytest.mark.skip', 'pytest.mark.skip', (['"""not implemented yet"""'], {}), False, 'import pytest\n'), (33, 'jina.peapods.pods.BasePod', 'BasePod', (['p'], {}), False, 'from jina.peapods.pods import BasePod\n'), (15, 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (['p'], {'kind': '"""pea"""'}), False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), (24, 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (['p'], {'kind': '"""pod"""'}), False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), (34, 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (['p'], {'kind': '"""pod"""'}), False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), (13, 'jina.parser.set_pea_parser', 'set_pea_parser', ([], {}), False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), (23, 'jina.parser.set_pod_parser', 'set_pod_parser', ([], {}), False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), (32, 'jina.parser.set_pod_parser', 'set_pod_parser', ([], {}), False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), (42, 'jina.flow.Flow', 'Flow', ([], {}), False, 'from jina.flow import Flow\n')]