mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-07 09:25:43 +00:00
* Refactor Tunnel to support selecting port for remote sshd * Refactor ssh tunnel to support MacOS version of ssh * Refactor Tunnel.close() to find and kill off zombie siblings * Add psutil dependency * Add logging setup, letting library produce debugging records * Clean up Tunnel API * Fix test_runner.sh to propagate returncode to caller Signed-off-by: Jhon Honce <jhonce@redhat.com> Closes: #1199 Approved by: rhatdan
35 lines
1 KiB
Python
35 lines
1 KiB
Python
from __future__ import absolute_import
|
|
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
import podman
|
|
from podman.client import BaseClient, Client, LocalClient, RemoteClient
|
|
|
|
|
|
class TestClient(unittest.TestCase):
|
|
def setUp(self):
|
|
pass
|
|
|
|
@patch('podman.libs.system.System.ping', return_value=True)
|
|
def test_local(self, mock_ping):
|
|
p = Client(
|
|
uri='unix:/run/podman',
|
|
interface='io.projectatomic.podman',
|
|
)
|
|
|
|
self.assertIsInstance(p._client, LocalClient)
|
|
self.assertIsInstance(p._client, BaseClient)
|
|
|
|
mock_ping.assert_called_once_with()
|
|
|
|
@patch('podman.libs.system.System.ping', return_value=True)
|
|
def test_remote(self, mock_ping):
|
|
p = Client(
|
|
uri='unix:/run/podman',
|
|
interface='io.projectatomic.podman',
|
|
remote_uri='ssh://user@hostname/run/podman/podman',
|
|
identity_file='~/.ssh/id_rsa')
|
|
|
|
self.assertIsInstance(p._client, BaseClient)
|
|
mock_ping.assert_called_once_with()
|