|
8 | 8 | import airos.exceptions |
9 | 9 | import pytest |
10 | 10 |
|
| 11 | +import aiofiles |
11 | 12 | import aiohttp |
12 | 13 | from mashumaro.exceptions import MissingField |
13 | 14 |
|
@@ -277,8 +278,9 @@ async def test_warnings_correctly_parses_json() -> None: |
277 | 278 | mock_response = MagicMock() |
278 | 279 | mock_response.__aenter__.return_value = mock_response |
279 | 280 | mock_response.status = 200 |
280 | | - with open("fixtures/warnings.json", encoding="utf-8") as f: |
281 | | - mock_response_data = json.load(f) |
| 281 | + async with aiofiles.open("fixtures/warnings.json") as f: |
| 282 | + content = await f.read() |
| 283 | + mock_response_data = json.loads(content) |
282 | 284 | mock_response.text = AsyncMock(return_value=json.dumps(mock_response_data)) |
283 | 285 |
|
284 | 286 | with patch.object(airos_device.session, "get", return_value=mock_response): |
@@ -327,8 +329,9 @@ async def test_update_check_correctly_parses_json() -> None: |
327 | 329 | mock_response = MagicMock() |
328 | 330 | mock_response.__aenter__.return_value = mock_response |
329 | 331 | mock_response.status = 200 |
330 | | - with open("fixtures/update_check_available.json", encoding="utf-8") as f: |
331 | | - mock_response_data = json.load(f) |
| 332 | + async with aiofiles.open("fixtures/update_check_available.json") as f: |
| 333 | + content = await f.read() |
| 334 | + mock_response_data = json.loads(content) |
332 | 335 | mock_response.text = AsyncMock(return_value=json.dumps(mock_response_data)) |
333 | 336 |
|
334 | 337 | with patch.object(airos_device.session, "post", return_value=mock_response): |
|
0 commit comments