diff --git a/homeassistant/components/nina/config_flow.py b/homeassistant/components/nina/config_flow.py index 42b68a4c76a..2eeec4de19d 100644 --- a/homeassistant/components/nina/config_flow.py +++ b/homeassistant/components/nina/config_flow.py @@ -141,7 +141,7 @@ class NinaConfigFlow(ConfigFlow, domain=DOMAIN): try: self._all_region_codes_sorted = swap_key_value( - await nina.getAllRegionalCodes() + await nina.get_all_regional_codes() ) except ApiError: return self.async_abort(reason="no_fetch") @@ -221,7 +221,7 @@ class OptionsFlowHandler(OptionsFlowWithReload): try: self._all_region_codes_sorted = swap_key_value( - await nina.getAllRegionalCodes() + await nina.get_all_regional_codes() ) except ApiError: return self.async_abort(reason="no_fetch") diff --git a/homeassistant/components/nina/coordinator.py b/homeassistant/components/nina/coordinator.py index 7097b24e41f..175b128fdba 100644 --- a/homeassistant/components/nina/coordinator.py +++ b/homeassistant/components/nina/coordinator.py @@ -66,7 +66,7 @@ class NINADataUpdateCoordinator( regions: dict[str, str] = config_entry.data[CONF_REGIONS] for region in regions: - self._nina.addRegion(region) + self._nina.add_region(region) super().__init__( hass, @@ -151,7 +151,7 @@ class NINADataUpdateCoordinator( raw_warn.sent or "", raw_warn.start or "", raw_warn.expires or "", - raw_warn.isValid(), + raw_warn.is_valid, ) warnings_for_regions.append(warning_data) diff --git a/homeassistant/components/nina/manifest.json b/homeassistant/components/nina/manifest.json index 85ac355c08d..80bcb4d24b1 100644 --- a/homeassistant/components/nina/manifest.json +++ b/homeassistant/components/nina/manifest.json @@ -8,6 +8,6 @@ "iot_class": "cloud_polling", "loggers": ["pynina"], "quality_scale": "bronze", - "requirements": ["pynina==0.3.6"], + "requirements": ["pynina==1.0.2"], "single_config_entry": true } diff --git a/requirements_all.txt b/requirements_all.txt index e3858be0ed0..fe1322de330 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2234,7 +2234,7 @@ pynetgear==0.10.10 pynetio==0.1.9.1 # homeassistant.components.nina -pynina==0.3.6 +pynina==1.0.2 # homeassistant.components.nintendo_parental_controls pynintendoauth==1.0.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index b58f997f0d5..1205567a287 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1887,7 +1887,7 @@ pynecil==4.2.1 pynetgear==0.10.10 # homeassistant.components.nina -pynina==0.3.6 +pynina==1.0.2 # homeassistant.components.nintendo_parental_controls pynintendoauth==1.0.2 diff --git a/tests/components/nina/__init__.py b/tests/components/nina/__init__.py index 539811e7f40..0cf078d5b79 100644 --- a/tests/components/nina/__init__.py +++ b/tests/components/nina/__init__.py @@ -17,7 +17,7 @@ from tests.common import ( async def setup_platform(hass: HomeAssistant, config_entry: MockConfigEntry) -> None: """Set up the NINA platform.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): await hass.config_entries.async_setup(config_entry.entry_id) diff --git a/tests/components/nina/snapshots/test_diagnostics.ambr b/tests/components/nina/snapshots/test_diagnostics.ambr index 331323ff76c..d9ff3c5f338 100644 --- a/tests/components/nina/snapshots/test_diagnostics.ambr +++ b/tests/components/nina/snapshots/test_diagnostics.ambr @@ -25,7 +25,7 @@ 'id': 'biw.BIWAPP-69634', 'is_valid': False, 'recommended_actions': '', - 'sender': '', + 'sender': None, 'sent': '1999-08-07T10:59:00+02:00', 'severity': 'Minor', 'start': '', diff --git a/tests/components/nina/test_config_flow.py b/tests/components/nina/test_config_flow.py index 4bde1891a80..25048a9654e 100644 --- a/tests/components/nina/test_config_flow.py +++ b/tests/components/nina/test_config_flow.py @@ -49,7 +49,7 @@ def assert_dummy_entry_created(result: dict[str, Any]) -> None: async def test_step_user_connection_error(hass: HomeAssistant) -> None: """Test starting a flow by user but no connection.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", side_effect=ApiError("Could not connect to Api"), ): result: dict[str, Any] = await hass.config_entries.flow.async_init( @@ -63,7 +63,7 @@ async def test_step_user_connection_error(hass: HomeAssistant) -> None: async def test_step_user_unexpected_exception(hass: HomeAssistant) -> None: """Test starting a flow by user but with an unexpected exception.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", side_effect=Exception("DUMMY"), ): result: dict[str, Any] = await hass.config_entries.flow.async_init( @@ -77,7 +77,7 @@ async def test_step_user_unexpected_exception(hass: HomeAssistant) -> None: async def test_step_user(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: """Test starting a flow by user with valid values.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): result: dict[str, Any] = await hass.config_entries.flow.async_init( @@ -95,7 +95,7 @@ async def test_step_user(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No async def test_step_user_no_selection(hass: HomeAssistant) -> None: """Test starting a flow by user with no selection.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): result: dict[str, Any] = await hass.config_entries.flow.async_init( @@ -121,7 +121,7 @@ async def test_step_user_already_configured( ) -> None: """Test starting a flow by user, but it was already configured.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): result = await hass.config_entries.flow.async_init( @@ -141,7 +141,7 @@ async def test_options_flow_init( with ( patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ), ): @@ -195,7 +195,7 @@ async def test_options_flow_with_no_selection( with ( patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ), ): @@ -263,7 +263,7 @@ async def test_options_flow_connection_error( await setup_platform(hass, mock_config_entry) with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", side_effect=ApiError("Could not connect to Api"), ): result = await hass.config_entries.options.async_init( @@ -283,7 +283,7 @@ async def test_options_flow_unexpected_exception( with ( patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", side_effect=Exception("DUMMY"), ), ): @@ -312,7 +312,7 @@ async def test_options_flow_entity_removal( with ( patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ), ): diff --git a/tests/components/nina/test_diagnostics.py b/tests/components/nina/test_diagnostics.py index 9a5538bacbb..fdce574b6f4 100644 --- a/tests/components/nina/test_diagnostics.py +++ b/tests/components/nina/test_diagnostics.py @@ -32,7 +32,7 @@ async def test_diagnostics( """Test diagnostics.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): config_entry: MockConfigEntry = MockConfigEntry( diff --git a/tests/components/nina/test_init.py b/tests/components/nina/test_init.py index feba6110f3f..ac6fa3b6617 100644 --- a/tests/components/nina/test_init.py +++ b/tests/components/nina/test_init.py @@ -28,7 +28,7 @@ async def init_integration(hass: HomeAssistant) -> MockConfigEntry: """Set up the NINA integration in Home Assistant.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): entry: MockConfigEntry = MockConfigEntry( @@ -54,7 +54,7 @@ async def test_config_migration_from1_1(hass: HomeAssistant) -> None: ) with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): old_conf_entry.add_to_hass(hass) @@ -82,7 +82,7 @@ async def test_config_migration_from1_2(hass: HomeAssistant) -> None: ) with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): old_conf_entry.add_to_hass(hass) @@ -104,7 +104,7 @@ async def test_config_migration_downgrade(hass: HomeAssistant) -> None: ) with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", wraps=mocked_request_function, ): conf_entry.add_to_hass(hass) @@ -126,7 +126,7 @@ async def test_config_entry_not_ready(hass: HomeAssistant) -> None: async def test_sensors_connection_error(hass: HomeAssistant) -> None: """Test the creation and values of the NINA sensors with no connected.""" with patch( - "pynina.baseApi.BaseAPI._makeRequest", + "pynina.api_client.APIClient.make_request", side_effect=ApiError("Could not connect to Api"), ): conf_entry: MockConfigEntry = MockConfigEntry(