|
15 | 15 | # specific language governing permissions and limitations
|
16 | 16 | # under the License.
|
17 | 17 |
|
18 |
| - |
19 |
| -import urllib3 |
20 |
| -import pytest |
21 |
| - |
22 |
| - |
23 | 18 | from urllib import parse
|
24 | 19 |
|
| 20 | +import pytest |
| 21 | +import urllib3 |
25 | 22 |
|
26 | 23 | from selenium import __version__
|
27 | 24 | from selenium.webdriver.remote.remote_connection import (
|
@@ -96,15 +93,21 @@ def test_get_connection_manager_without_proxy(mock_proxy_settings_missing):
|
96 | 93 | assert type(conn) == urllib3.PoolManager
|
97 | 94 |
|
98 | 95 |
|
99 |
| -def test_get_connection_manager_for_certs_and_timeout(): |
| 96 | +def test_get_connection_manager_for_certs_and_timeout(monkeypatch): |
| 97 | + monkeypatch.setattr(RemoteConnection, "get_timeout", lambda _: 10) # Class state; leaks into subsequent tests. |
100 | 98 | remote_connection = RemoteConnection('http://remote', keep_alive=False)
|
101 |
| - remote_connection.set_timeout(10) |
102 | 99 | conn = remote_connection._get_connection_manager()
|
103 | 100 | assert conn.connection_pool_kw['timeout'] == 10
|
104 | 101 | assert conn.connection_pool_kw['cert_reqs'] == 'CERT_REQUIRED'
|
105 | 102 | assert 'certifi/cacert.pem' in conn.connection_pool_kw['ca_certs']
|
106 | 103 |
|
107 | 104 |
|
| 105 | +def test_default_socket_timeout_is_correct(): |
| 106 | + remote_connection = RemoteConnection("http://remote", keep_alive=True) |
| 107 | + conn = remote_connection._get_connection_manager() |
| 108 | + assert conn.connection_pool_kw['timeout'] is None |
| 109 | + |
| 110 | + |
108 | 111 | def test_get_connection_manager_with_proxy(mock_proxy_settings):
|
109 | 112 | remote_connection = RemoteConnection('http://remote', keep_alive=False)
|
110 | 113 | conn = remote_connection._get_connection_manager()
|
|
0 commit comments