diff --git a/airos/airos8.py b/airos/airos8.py index 97b7c24..1c164c3 100644 --- a/airos/airos8.py +++ b/airos/airos8.py @@ -187,7 +187,7 @@ async def login(self) -> bool: logger.exception("Error during login") raise DeviceConnectionError from err - async def status(self, return_json: bool = False) -> dict | AirOSData: + async def status(self) -> AirOSData: """Retrieve status from the device.""" if not self.connected: logger.error("Not connected, login first") @@ -220,8 +220,6 @@ async def status(self, return_json: bool = False) -> dict | AirOSData: log = f"AirOS data warning for field '{field_name}': {msg}" logger.warning(log) - if return_json: - return response_json return airos_data except json.JSONDecodeError: logger.exception( diff --git a/pyproject.toml b/pyproject.toml index 862c528..4eb10fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "airos" -version = "0.1.2" +version = "0.1.3" license = "MIT" description = "Ubiquity airOS module(s) for Python 3." readme = "README.md" diff --git a/tests/test_stations.py b/tests/test_stations.py index 65c10b1..8f32a7d 100644 --- a/tests/test_stations.py +++ b/tests/test_stations.py @@ -26,41 +26,6 @@ async def _read_fixture(fixture: str = "ap-ptp"): pytest.fail(f"Invalid JSON in fixture file {path}: {e}") -@pytest.mark.parametrize("mode", ["ap-ptp", "sta-ptp"]) -@pytest.mark.asyncio -async def test_ap_json(airos_device, base_url, mode): - """Test device operation.""" - cookie = SimpleCookie() - cookie["session_id"] = "test-cookie" - cookie["AIROS_TOKEN"] = "abc123" - - # --- Prepare fake POST /api/auth response with cookies --- - mock_login_response = MagicMock() - mock_login_response.__aenter__.return_value = mock_login_response - mock_login_response.text = AsyncMock(return_value="{}") - mock_login_response.status = 200 - mock_login_response.cookies = cookie - mock_login_response.headers = {"X-CSRF-ID": "test-csrf-token"} - # --- Prepare fake GET /api/status response --- - fixture_data = await _read_fixture(mode) - mock_status_payload = fixture_data - mock_status_response = MagicMock() - mock_status_response.__aenter__.return_value = mock_status_response - mock_status_response.text = AsyncMock(return_value=json.dumps(fixture_data)) - mock_status_response.status = 200 - mock_status_response.json = AsyncMock(return_value=mock_status_payload) - - with ( - patch.object(airos_device.session, "post", return_value=mock_login_response), - patch.object(airos_device.session, "get", return_value=mock_status_response), - ): - assert await airos_device.login() - status = await airos_device.status(return_json=True) - - # Verify the fixture returns the correct mode - assert status.get("wireless", {}).get("mode") == mode - - @pytest.mark.parametrize("mode", ["ap-ptp", "sta-ptp"]) @pytest.mark.asyncio async def test_ap_object(airos_device, base_url, mode):