From b03dbeaed5d0c70ea774e9f991ad0941334d003e Mon Sep 17 00:00:00 2001 From: Mark Kennedy Date: Wed, 31 May 2023 15:57:45 +0100 Subject: [PATCH] Block legacy get-mac in preference of getmac (#87712) Co-authored-by: GnatorX --- homeassistant/components/vilfo/manifest.json | 2 +- homeassistant/package_constraints.txt | 4 +++ requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- script/gen_requirements_all.py | 4 +++ tests/components/vilfo/test_config_flow.py | 34 ++++++++++++++++---- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/vilfo/manifest.json b/homeassistant/components/vilfo/manifest.json index 4b82bba83cd..850d4fecb27 100644 --- a/homeassistant/components/vilfo/manifest.json +++ b/homeassistant/components/vilfo/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/vilfo", "iot_class": "local_polling", "loggers": ["vilfo"], - "requirements": ["vilfo-api-client==0.3.2"] + "requirements": ["vilfo-api-client==0.4.1"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 1361c41d74b..70dbe4199fd 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -179,3 +179,7 @@ pysnmp==1000000000.0.0 # pyminiaudio 1.58 is missing files in the package # https://github.com/irmen/pyminiaudio/issues/67 miniaudio==1.57 + +# The get-mac package has been replaced with getmac. Installing get-mac alongside getmac +# breaks getmac due to them both sharing the same python package name inside 'getmac'. +get-mac==1000000000.0.0 diff --git a/requirements_all.txt b/requirements_all.txt index 905334319d1..92449d083b7 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2604,7 +2604,7 @@ velbus-aio==2023.2.0 venstarcolortouch==0.19 # homeassistant.components.vilfo -vilfo-api-client==0.3.2 +vilfo-api-client==0.4.1 # homeassistant.components.voip voip-utils==0.0.7 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 2afc6ed8783..dffbc65c812 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1892,7 +1892,7 @@ velbus-aio==2023.2.0 venstarcolortouch==0.19 # homeassistant.components.vilfo -vilfo-api-client==0.3.2 +vilfo-api-client==0.4.1 # homeassistant.components.voip voip-utils==0.0.7 diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index 45009dedc7c..b51ddb46307 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -183,6 +183,10 @@ pysnmp==1000000000.0.0 # pyminiaudio 1.58 is missing files in the package # https://github.com/irmen/pyminiaudio/issues/67 miniaudio==1.57 + +# The get-mac package has been replaced with getmac. Installing get-mac alongside getmac +# breaks getmac due to them both sharing the same python package name inside 'getmac'. +get-mac==1000000000.0.0 """ IGNORE_PRE_COMMIT_HOOK_ID = ( diff --git a/tests/components/vilfo/test_config_flow.py b/tests/components/vilfo/test_config_flow.py index c180f154a27..0aa59c9271f 100644 --- a/tests/components/vilfo/test_config_flow.py +++ b/tests/components/vilfo/test_config_flow.py @@ -13,6 +13,7 @@ async def test_form(hass: HomeAssistant) -> None: """Test we get the form.""" mock_mac = "FF-00-00-00-00-00" + firmware_version = "1.1.0" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) @@ -21,7 +22,11 @@ async def test_form(hass: HomeAssistant) -> None: with patch("vilfo.Client.ping", return_value=None), patch( "vilfo.Client.get_board_information", return_value=None - ), patch("vilfo.Client.resolve_mac_address", return_value=mock_mac), patch( + ), patch( + "vilfo.Client.resolve_firmware_version", return_value=firmware_version + ), patch( + "vilfo.Client.resolve_mac_address", return_value=mock_mac + ), patch( "homeassistant.components.vilfo.async_setup_entry" ) as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( @@ -106,11 +111,15 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: first_flow_result1 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - + firmware_version = "1.1.0" with patch("vilfo.Client.ping", return_value=None), patch( "vilfo.Client.get_board_information", return_value=None, - ), patch("vilfo.Client.resolve_mac_address", return_value=None): + ), patch( + "vilfo.Client.resolve_firmware_version", return_value=firmware_version + ), patch( + "vilfo.Client.resolve_mac_address", return_value=None + ): first_flow_result2 = await hass.config_entries.flow.async_configure( first_flow_result1["flow_id"], {CONF_HOST: "testadmin.vilfo.com", CONF_ACCESS_TOKEN: "test-token"}, @@ -123,7 +132,11 @@ async def test_form_already_configured(hass: HomeAssistant) -> None: with patch("vilfo.Client.ping", return_value=None), patch( "vilfo.Client.get_board_information", return_value=None, - ), patch("vilfo.Client.resolve_mac_address", return_value=None): + ), patch( + "vilfo.Client.resolve_firmware_version", return_value=firmware_version + ), patch( + "vilfo.Client.resolve_mac_address", return_value=None + ): second_flow_result2 = await hass.config_entries.flow.async_configure( second_flow_result1["flow_id"], {CONF_HOST: "testadmin.vilfo.com", CONF_ACCESS_TOKEN: "test-token"}, @@ -158,10 +171,15 @@ async def test_validate_input_returns_data(hass: HomeAssistant) -> None: mock_data_with_ip = {"host": "192.168.0.1", "access_token": "test-token"} mock_data_with_ipv6 = {"host": "2001:db8::1428:57ab", "access_token": "test-token"} mock_mac = "FF-00-00-00-00-00" + firmware_version = "1.1.0" with patch("vilfo.Client.ping", return_value=None), patch( "vilfo.Client.get_board_information", return_value=None - ), patch("vilfo.Client.resolve_mac_address", return_value=None): + ), patch( + "vilfo.Client.resolve_firmware_version", return_value=firmware_version + ), patch( + "vilfo.Client.resolve_mac_address", return_value=None + ): result = await hass.components.vilfo.config_flow.validate_input( hass, data=mock_data ) @@ -173,7 +191,11 @@ async def test_validate_input_returns_data(hass: HomeAssistant) -> None: with patch("vilfo.Client.ping", return_value=None), patch( "vilfo.Client.get_board_information", return_value=None - ), patch("vilfo.Client.resolve_mac_address", return_value=mock_mac): + ), patch( + "vilfo.Client.resolve_firmware_version", return_value=firmware_version + ), patch( + "vilfo.Client.resolve_mac_address", return_value=mock_mac + ): result2 = await hass.components.vilfo.config_flow.validate_input( hass, data=mock_data )