|
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 isaacus.types.classifications.universal_create_params import UniversalCreateParams |
@@ -850,6 +852,28 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: |
850 | 852 |
|
851 | 853 | assert response.http_request.headers.get("x-stainless-retry-count") == "42" |
852 | 854 |
|
| 855 | + def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: |
| 856 | + # Test that the proxy environment variables are set correctly |
| 857 | + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") |
| 858 | + |
| 859 | + client = DefaultHttpxClient() |
| 860 | + |
| 861 | + mounts = tuple(client._mounts.items()) |
| 862 | + assert len(mounts) == 1 |
| 863 | + assert mounts[0][0].pattern == "https://" |
| 864 | + |
| 865 | + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") |
| 866 | + def test_default_client_creation(self) -> None: |
| 867 | + # Ensure that the client can be initialized without any exceptions |
| 868 | + DefaultHttpxClient( |
| 869 | + verify=True, |
| 870 | + cert=None, |
| 871 | + trust_env=True, |
| 872 | + http1=True, |
| 873 | + http2=False, |
| 874 | + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), |
| 875 | + ) |
| 876 | + |
853 | 877 | @pytest.mark.respx(base_url=base_url) |
854 | 878 | def test_follow_redirects(self, respx_mock: MockRouter) -> None: |
855 | 879 | # Test that the default follow_redirects=True allows following redirects |
@@ -1735,6 +1759,28 @@ async def test_main() -> None: |
1735 | 1759 |
|
1736 | 1760 | time.sleep(0.1) |
1737 | 1761 |
|
| 1762 | + async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: |
| 1763 | + # Test that the proxy environment variables are set correctly |
| 1764 | + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") |
| 1765 | + |
| 1766 | + client = DefaultAsyncHttpxClient() |
| 1767 | + |
| 1768 | + mounts = tuple(client._mounts.items()) |
| 1769 | + assert len(mounts) == 1 |
| 1770 | + assert mounts[0][0].pattern == "https://" |
| 1771 | + |
| 1772 | + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") |
| 1773 | + async def test_default_client_creation(self) -> None: |
| 1774 | + # Ensure that the client can be initialized without any exceptions |
| 1775 | + DefaultAsyncHttpxClient( |
| 1776 | + verify=True, |
| 1777 | + cert=None, |
| 1778 | + trust_env=True, |
| 1779 | + http1=True, |
| 1780 | + http2=False, |
| 1781 | + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), |
| 1782 | + ) |
| 1783 | + |
1738 | 1784 | @pytest.mark.respx(base_url=base_url) |
1739 | 1785 | async def test_follow_redirects(self, respx_mock: MockRouter) -> None: |
1740 | 1786 | # Test that the default follow_redirects=True allows following redirects |
|
0 commit comments