| Index: tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/manage/test_ssh.py
|
| diff --git a/tools/telemetry/third_party/gsutilz/third_party/gcs-oauth2-boto-plugin/gcs_oauth2_boto_plugin/__init__.py b/tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/manage/test_ssh.py
|
| old mode 100644
|
| new mode 100755
|
| similarity index 52%
|
| copy from tools/telemetry/third_party/gsutilz/third_party/gcs-oauth2-boto-plugin/gcs_oauth2_boto_plugin/__init__.py
|
| copy to tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/manage/test_ssh.py
|
| index a70e6515e01f13e404e77ef814accaa5ba5c157e..b1db654e48b0bfdc8984d2bde738a61dd82d153a
|
| --- a/tools/telemetry/third_party/gsutilz/third_party/gcs-oauth2-boto-plugin/gcs_oauth2_boto_plugin/__init__.py
|
| +++ b/tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/manage/test_ssh.py
|
| @@ -1,4 +1,5 @@
|
| -# Copyright 2014 Google Inc. All Rights Reserved.
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
|
| #
|
| # Permission is hereby granted, free of charge, to any person obtaining a
|
| # copy of this software and associated documentation files (the
|
| @@ -18,13 +19,36 @@
|
| # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| # IN THE SOFTWARE.
|
| +#
|
| +
|
| +try:
|
| + import paramiko
|
| + from boto.manage.cmdshell import SSHClient
|
| +except ImportError:
|
| + paramiko = None
|
| + SSHClient = None
|
| +
|
| +from tests.compat import mock, unittest
|
| +
|
| +
|
| +class TestSSHTimeout(unittest.TestCase):
|
| + @unittest.skipIf(not paramiko, 'Paramiko missing')
|
| + def test_timeout(self):
|
| + client_tmp = paramiko.SSHClient
|
| +
|
| + def client_mock():
|
| + client = client_tmp()
|
| + client.connect = mock.Mock(name='connect')
|
| + return client
|
| +
|
| + paramiko.SSHClient = client_mock
|
| + paramiko.RSAKey.from_private_key_file = mock.Mock()
|
|
|
| -from __future__ import absolute_import
|
| + server = mock.Mock()
|
| + test = SSHClient(server)
|
|
|
| -# Import this module so that users can simply import the top-level module. Once
|
| -# imported, boto will pick up our subclasses of AuthHandler.
|
| -from gcs_oauth2_boto_plugin import oauth2_plugin
|
| + self.assertEqual(test._ssh_client.connect.call_args[1]['timeout'], None)
|
|
|
| -from gcs_oauth2_boto_plugin.oauth2_helper import SetFallbackClientIdAndSecret
|
| -from gcs_oauth2_boto_plugin.oauth2_helper import SetLock
|
| + test2 = SSHClient(server, timeout=30)
|
|
|
| + self.assertEqual(test2._ssh_client.connect.call_args[1]['timeout'], 30)
|
|
|