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, 1, 11, 95), 'pytest.mark.skip', 'pytest.mark.skip', ({(11, 18, 11, 94): '"""works locally, but until I findout how to mock ssh, this has to be skipped"""'}, {}), "(\n    'works locally, but until I findout how to mock ssh, this has to be skipped'\n    )", False, 'import pytest\n'), ((21, 1, 21, 96), 'pytest.mark.skip', 'pytest.mark.skip', ({(21, 18, 21, 95): '"""works locally, but until I find out how to mock ssh, this has to be skipped"""'}, {}), "(\n    'works locally, but until I find out how to mock ssh, this has to be skipped'\n    )", False, 'import pytest\n'), ((30, 1, 30, 40), 'pytest.mark.skip', 'pytest.mark.skip', ({(30, 18, 30, 39): '"""not implemented yet"""'}, {}), "('not implemented yet')", False, 'import pytest\n'), ((40, 1, 40, 40), 'pytest.mark.skip', 'pytest.mark.skip', ({(40, 18, 40, 39): '"""not implemented yet"""'}, {}), "('not implemented yet')", False, 'import pytest\n'), ((33, 8, 33, 18), 'jina.peapods.pods.BasePod', 'BasePod', ({(33, 16, 33, 17): 'p'}, {}), '(p)', False, 'from jina.peapods.pods import BasePod\n'), ((15, 9, 15, 34), 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (), '', False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), ((24, 9, 24, 34), 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (), '', False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), ((34, 9, 34, 34), 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (), '', False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), ((13, 8, 13, 24), 'jina.parser.set_pea_parser', 'set_pea_parser', ({}, {}), '()', False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), ((23, 8, 23, 24), 'jina.parser.set_pod_parser', 'set_pod_parser', ({}, {}), '()', False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), ((32, 8, 32, 24), 'jina.parser.set_pod_parser', 'set_pod_parser', ({}, {}), '()', False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), ((42, 8, 42, 14), 'jina.flow.Flow', 'Flow', ({}, {}), '()', False, 'from jina.flow import Flow\n')]