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

[((266, 370), 'pytest.mark.skip', 'pytest.mark.skip', (['"""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    )\n", (282, 370), False, 'import pytest\n'), ((621, 726), 'pytest.mark.skip', 'pytest.mark.skip', (['"""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    )\n", (637, 726), False, 'import pytest\n'), ((976, 1015), 'pytest.mark.skip', 'pytest.mark.skip', (['"""not implemented yet"""'], {}), "('not implemented yet')\n", (992, 1015), False, 'import pytest\n'), ((1302, 1341), 'pytest.mark.skip', 'pytest.mark.skip', (['"""not implemented yet"""'], {}), "('not implemented yet')\n", (1318, 1341), False, 'import pytest\n'), ((1140, 1150), 'jina.peapods.pods.BasePod', 'BasePod', (['p'], {}), '(p)\n', (1147, 1150), False, 'from jina.peapods.pods import BasePod\n'), ((479, 504), 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (['p'], {'kind': '"""pea"""'}), "(p, kind='pea')\n", (489, 504), False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), ((834, 859), 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (['p'], {'kind': '"""pod"""'}), "(p, kind='pod')\n", (844, 859), False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), ((1160, 1185), 'jina.peapods.runtimes.remote.ssh.SSHRuntime', 'SSHRuntime', (['p'], {'kind': '"""pod"""'}), "(p, kind='pod')\n", (1170, 1185), False, 'from jina.peapods.runtimes.remote.ssh import SSHRuntime\n'), ((389, 405), 'jina.parser.set_pea_parser', 'set_pea_parser', ([], {}), '()\n', (403, 405), False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), ((745, 761), 'jina.parser.set_pod_parser', 'set_pod_parser', ([], {}), '()\n', (759, 761), False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), ((1052, 1068), 'jina.parser.set_pod_parser', 'set_pod_parser', ([], {}), '()\n', (1066, 1068), False, 'from jina.parser import set_pea_parser, set_pod_parser\n'), ((1367, 1373), 'jina.flow.Flow', 'Flow', ([], {}), '()\n', (1371, 1373), False, 'from jina.flow import Flow\n')]