|
2 | 2 | Tests for backward compatibility in models.get() method. |
3 | 3 | """ |
4 | 4 |
|
5 | | -from unittest.mock import Mock, AsyncMock, patch |
| 5 | +from unittest.mock import Mock, AsyncMock |
6 | 6 |
|
7 | 7 | import pytest |
8 | 8 |
|
@@ -36,8 +36,7 @@ class TestModelGetBackwardCompatibility: |
36 | 36 | @pytest.fixture |
37 | 37 | def client(self): |
38 | 38 | """Create a Replicate client with mocked token.""" |
39 | | - with patch("replicate.lib.cog._get_api_token_from_environment", return_value="test-token"): |
40 | | - return Replicate() |
| 39 | + return Replicate(bearer_token="test-token") |
41 | 40 |
|
42 | 41 | def test_legacy_format_owner_name(self, client, mock_model_response): |
43 | 42 | """Test legacy format: models.get('owner/name').""" |
@@ -150,8 +149,7 @@ class TestAsyncModelGetBackwardCompatibility: |
150 | 149 | @pytest.fixture |
151 | 150 | async def async_client(self): |
152 | 151 | """Create an async Replicate client with mocked token.""" |
153 | | - with patch("replicate.lib.cog._get_api_token_from_environment", return_value="test-token"): |
154 | | - return AsyncReplicate() |
| 152 | + return AsyncReplicate(bearer_token="test-token") |
155 | 153 |
|
156 | 154 | @pytest.mark.asyncio |
157 | 155 | async def test_async_legacy_format_owner_name(self, async_client, mock_model_response): |
@@ -208,8 +206,7 @@ class TestModelVersionIdentifierIntegration: |
208 | 206 | @pytest.fixture |
209 | 207 | def client(self): |
210 | 208 | """Create a Replicate client with mocked token.""" |
211 | | - with patch("replicate.lib.cog._get_api_token_from_environment", return_value="test-token"): |
212 | | - return Replicate() |
| 209 | + return Replicate(bearer_token="test-token") |
213 | 210 |
|
214 | 211 | def test_legacy_format_parsing_edge_cases(self, client, mock_model_response): |
215 | 212 | """Test edge cases in legacy format parsing.""" |
|
0 commit comments