fix(driver): stop guessing whether a speaker is wired
The wired check read device_properties, which SoCo does not have (deviceProperties is the UPnP service, and none of its actions says wired or wireless), and swallowed the AttributeError, so eth0 was never reported and the guess served nothing. It is gone: a speaker reports its one connection as wlan0, described as of unknown medium, and the README and the getter docstrings say that wired vs. wireless is not known. Closes #2
This commit is contained in:
1 parent
7a9acd5bbb
commit
53ea5f051f
4 files changed
+38
-44
No files matched your search
@@ -106,6 +106,18 @@ class TestSonosDriver:
|
||||
assert ifaces["wlan0"]["is_up"] is True
|
||||
assert ifaces["wlan0"]["mac_address"] == "00:0E:58:AB:CD:EF"
|
||||
|
||||
def test_a_speaker_reports_no_eth0(self):
|
||||
"""SoCo has no reading that tells wired from wireless (#2): the driver no
|
||||
longer guesses, not even from a dict-like WifiMode it used to look for."""
|
||||
self.mock_device.device_properties = {"WifiMode": "0"}
|
||||
|
||||
with patch("socket.create_connection"):
|
||||
interfaces = self.driver.get_interfaces()
|
||||
assert "eth0" not in self.driver.get_facts()["interface_list"]
|
||||
assert "eth0" not in interfaces
|
||||
assert "eth0" not in self.driver.get_interfaces_ip()
|
||||
assert list(interfaces) == ["wlan0"]
|
||||
|
||||
def test_get_interfaces_ip(self):
|
||||
ifaces_ip = self.driver.get_interfaces_ip()
|
||||
assert "wlan0" in ifaces_ip
|
||||
|
||||
Reference in new issue
Block a user