|
31 | 31 | DEFAULT_TIMEOUT,
|
32 | 32 | HTTPX_DEFAULT_TIMEOUT,
|
33 | 33 | BaseClient,
|
| 34 | + DefaultHttpxClient, |
| 35 | + DefaultAsyncHttpxClient, |
34 | 36 | make_request_options,
|
35 | 37 | )
|
36 | 38 | from runloop_api_client.types.devbox_create_params import DevboxCreateParams
|
@@ -873,6 +875,28 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
|
873 | 875 |
|
874 | 876 | assert response.http_request.headers.get("x-stainless-retry-count") == "42"
|
875 | 877 |
|
| 878 | + def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: |
| 879 | + # Test that the proxy environment variables are set correctly |
| 880 | + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") |
| 881 | + |
| 882 | + client = DefaultHttpxClient() |
| 883 | + |
| 884 | + mounts = tuple(client._mounts.items()) |
| 885 | + assert len(mounts) == 1 |
| 886 | + assert mounts[0][0].pattern == "https://" |
| 887 | + |
| 888 | + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") |
| 889 | + def test_default_client_creation(self) -> None: |
| 890 | + # Ensure that the client can be initialized without any exceptions |
| 891 | + DefaultHttpxClient( |
| 892 | + verify=True, |
| 893 | + cert=None, |
| 894 | + trust_env=True, |
| 895 | + http1=True, |
| 896 | + http2=False, |
| 897 | + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), |
| 898 | + ) |
| 899 | + |
876 | 900 | @pytest.mark.respx(base_url=base_url)
|
877 | 901 | def test_follow_redirects(self, respx_mock: MockRouter) -> None:
|
878 | 902 | # Test that the default follow_redirects=True allows following redirects
|
@@ -1769,6 +1793,28 @@ async def test_main() -> None:
|
1769 | 1793 |
|
1770 | 1794 | time.sleep(0.1)
|
1771 | 1795 |
|
| 1796 | + async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: |
| 1797 | + # Test that the proxy environment variables are set correctly |
| 1798 | + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") |
| 1799 | + |
| 1800 | + client = DefaultAsyncHttpxClient() |
| 1801 | + |
| 1802 | + mounts = tuple(client._mounts.items()) |
| 1803 | + assert len(mounts) == 1 |
| 1804 | + assert mounts[0][0].pattern == "https://" |
| 1805 | + |
| 1806 | + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") |
| 1807 | + async def test_default_client_creation(self) -> None: |
| 1808 | + # Ensure that the client can be initialized without any exceptions |
| 1809 | + DefaultAsyncHttpxClient( |
| 1810 | + verify=True, |
| 1811 | + cert=None, |
| 1812 | + trust_env=True, |
| 1813 | + http1=True, |
| 1814 | + http2=False, |
| 1815 | + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), |
| 1816 | + ) |
| 1817 | + |
1772 | 1818 | @pytest.mark.respx(base_url=base_url)
|
1773 | 1819 | async def test_follow_redirects(self, respx_mock: MockRouter) -> None:
|
1774 | 1820 | # Test that the default follow_redirects=True allows following redirects
|
|
0 commit comments