mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-05-02 06:11:00 +01:00
Improve connection settings tests (#5278)
* Improve connection settings fixture Make the connection settings fixture behave more closely to the actual NetworkManager. The behavior has been tested with NetworkManager 1.42.4 (Debian 12) and 1.44.2 (HAOS 13.1). This likely behaves similar in older versions too. * Introduce separate skeleton and settings for wireless Instead of having a combined network settings object which has Ethernet and Wirless settings, create a separate settings object for wireless. * Handle addresses/address-data property like NetworkManager * Address ruff check * Improve network API test Add a test which changes from "static" to "auto". Validate that settings are updated accordingly. Specifically, today this does clear the DNS setting (by not providing the property). * ruff format * ruff check * Complete TEST_INTERFACE rename * Add partial network update as test case
This commit is contained in:
@@ -9,12 +9,12 @@ from supervisor.host.configuration import IpConfig, IpSetting, VlanConfig
|
||||
from supervisor.host.const import InterfaceMethod, InterfaceType
|
||||
from supervisor.host.network import Interface
|
||||
|
||||
from tests.const import TEST_INTERFACE
|
||||
from tests.const import TEST_INTERFACE_ETH_NAME
|
||||
|
||||
|
||||
async def test_get_connection_from_interface(network_manager: NetworkManager):
|
||||
"""Test network interface."""
|
||||
dbus_interface = network_manager.get(TEST_INTERFACE)
|
||||
dbus_interface = network_manager.get(TEST_INTERFACE_ETH_NAME)
|
||||
interface = Interface.from_dbus_interface(dbus_interface)
|
||||
connection_payload = get_connection_from_interface(interface, network_manager)
|
||||
|
||||
@@ -33,7 +33,7 @@ async def test_get_connection_from_interface(network_manager: NetworkManager):
|
||||
|
||||
async def test_get_connection_no_path(network_manager: NetworkManager):
|
||||
"""Test network interface without a path."""
|
||||
dbus_interface = network_manager.get(TEST_INTERFACE)
|
||||
dbus_interface = network_manager.get(TEST_INTERFACE_ETH_NAME)
|
||||
with patch.object(NetworkInterface, "path", new=PropertyMock(return_value=None)):
|
||||
interface = Interface.from_dbus_interface(dbus_interface)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user