1- """Ubiquiti AirOS tests."""
1+ """Ubiquiti AirOS8 tests."""
22
33from http .cookies import SimpleCookie
44import json
55import os
6- from typing import Any , cast
6+ from typing import Any
77from unittest .mock import AsyncMock , MagicMock , patch
88
99import aiofiles
1010from mashumaro .exceptions import MissingField
1111import pytest
1212
13- from airos .airos8 import AirOS
14- from airos .data import AirOS8Data as AirOSData , Wireless
13+ from airos .airos8 import AirOS8
14+ from airos .data import AirOS8Data , Wireless
1515from airos .exceptions import AirOSDeviceConnectionError , AirOSKeyDataMissingError
1616
1717
@@ -32,7 +32,7 @@ async def _read_fixture(fixture: str = "loco5ac_ap-ptp") -> Any:
3232@patch ("airos.airos8._LOGGER" )
3333@pytest .mark .asyncio
3434async def test_status_logs_redacted_data_on_invalid_value (
35- mock_logger : MagicMock , airos8_device : AirOS
35+ mock_logger : MagicMock , airos8_device : AirOS8
3636) -> None :
3737 """Test that the status method correctly logs redacted data when it encounters an InvalidFieldValue during deserialization."""
3838 # --- Prepare fake POST /api/auth response with cookies ---
@@ -62,7 +62,7 @@ async def test_status_logs_redacted_data_on_invalid_value(
6262 patch (
6363 "airos.airos8.AirOSData.from_dict" ,
6464 side_effect = MissingField (
65- field_name = "wireless" , field_type = Wireless , holder_class = AirOSData
65+ field_name = "wireless" , field_type = Wireless , holder_class = AirOS8Data
6666 ),
6767 ),
6868 ):
@@ -98,7 +98,7 @@ async def test_status_logs_redacted_data_on_invalid_value(
9898@patch ("airos.airos8._LOGGER" )
9999@pytest .mark .asyncio
100100async def test_status_logs_exception_on_missing_field (
101- mock_logger : MagicMock , airos8_device : AirOS
101+ mock_logger : MagicMock , airos8_device : AirOS8
102102) -> None :
103103 """Test that the status method correctly logs a full exception when it encounters a MissingField during deserialization."""
104104 # --- Prepare fake POST /api/auth response with cookies ---
@@ -154,7 +154,7 @@ async def test_status_logs_exception_on_missing_field(
154154)
155155@pytest .mark .asyncio
156156async def test_ap_object (
157- airos8_device : AirOS , base_url : str , mode : str , fixture : str
157+ airos8_device : AirOS8 , base_url : str , mode : str , fixture : str
158158) -> None :
159159 """Test device operation using the new _request_json method."""
160160 fixture_data = await _read_fixture (fixture )
@@ -175,7 +175,7 @@ async def test_ap_object(
175175 ):
176176 # We don't need to patch the session directly anymore
177177 await airos8_device .login ()
178- status = cast ( AirOSData , await airos8_device .status () )
178+ status : AirOS8Data = await airos8_device .status ()
179179
180180 # Assertions remain the same as they check the final result
181181 assert status .wireless .mode
@@ -189,7 +189,7 @@ async def test_ap_object(
189189
190190@pytest .mark .skip (reason = "broken, needs investigation" )
191191@pytest .mark .asyncio
192- async def test_reconnect (airos8_device : AirOS , base_url : str ) -> None :
192+ async def test_reconnect (airos8_device : AirOS8 , base_url : str ) -> None :
193193 """Test reconnect client."""
194194 # --- Prepare fake POST /api/stakick response ---
195195 mock_stakick_response = MagicMock ()
0 commit comments