@@ -26,41 +26,6 @@ async def _read_fixture(fixture: str = "ap-ptp"):
2626 pytest .fail (f"Invalid JSON in fixture file { path } : { e } " )
2727
2828
29- @pytest .mark .parametrize ("mode" , ["ap-ptp" , "sta-ptp" ])
30- @pytest .mark .asyncio
31- async def test_ap_json (airos_device , base_url , mode ):
32- """Test device operation."""
33- cookie = SimpleCookie ()
34- cookie ["session_id" ] = "test-cookie"
35- cookie ["AIROS_TOKEN" ] = "abc123"
36-
37- # --- Prepare fake POST /api/auth response with cookies ---
38- mock_login_response = MagicMock ()
39- mock_login_response .__aenter__ .return_value = mock_login_response
40- mock_login_response .text = AsyncMock (return_value = "{}" )
41- mock_login_response .status = 200
42- mock_login_response .cookies = cookie
43- mock_login_response .headers = {"X-CSRF-ID" : "test-csrf-token" }
44- # --- Prepare fake GET /api/status response ---
45- fixture_data = await _read_fixture (mode )
46- mock_status_payload = fixture_data
47- mock_status_response = MagicMock ()
48- mock_status_response .__aenter__ .return_value = mock_status_response
49- mock_status_response .text = AsyncMock (return_value = json .dumps (fixture_data ))
50- mock_status_response .status = 200
51- mock_status_response .json = AsyncMock (return_value = mock_status_payload )
52-
53- with (
54- patch .object (airos_device .session , "post" , return_value = mock_login_response ),
55- patch .object (airos_device .session , "get" , return_value = mock_status_response ),
56- ):
57- assert await airos_device .login ()
58- status = await airos_device .status (return_json = True )
59-
60- # Verify the fixture returns the correct mode
61- assert status .get ("wireless" , {}).get ("mode" ) == mode
62-
63-
6429@pytest .mark .parametrize ("mode" , ["ap-ptp" , "sta-ptp" ])
6530@pytest .mark .asyncio
6631async def test_ap_object (airos_device , base_url , mode ):
0 commit comments