summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/test_ssh.py9
-rw-r--r--yardstick/ssh.py6
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/test_ssh.py b/tests/unit/test_ssh.py
index b298c745b..88699fd85 100644
--- a/tests/unit/test_ssh.py
+++ b/tests/unit/test_ssh.py
@@ -546,6 +546,15 @@ class TestAutoConnectSSH(unittest.TestCase):
with mock_scp_client_type() as mock_scp_client:
self.assertEqual(mock_scp_client.put.call_count, 1)
+ @mock.patch('yardstick.ssh.SCPClient')
+ def test_get(self, mock_scp_client_type):
+ auto_connect_ssh = AutoConnectSSH('user1', 'host1')
+ auto_connect_ssh._client = mock.Mock()
+
+ auto_connect_ssh.get('a', 'z')
+ with mock_scp_client_type() as mock_scp_client:
+ self.assertEqual(mock_scp_client.get.call_count, 1)
+
def test_put_file(self):
auto_connect_ssh = AutoConnectSSH('user1', 'host1')
auto_connect_ssh._client = mock.Mock()
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index e98ee98b7..6ddf327f2 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -379,6 +379,12 @@ class SSH(object):
with SCPClient(client.get_transport()) as scp:
scp.put(files, remote_path, recursive)
+ def get(self, remote_path, local_path='/tmp/', recursive=True):
+ client = self._get_client()
+
+ with SCPClient(client.get_transport()) as scp:
+ scp.get(remote_path, local_path, recursive)
+
# keep shell running in the background, e.g. screen
def send_command(self, command):
client = self._get_client()