fix(driver): leave the caller's optional_args unchanged

__init__ popped "port" out of the dict it was handed, so the caller's
own optional_args lost its port. The driver now works on a copy.

Closes #19
This commit is contained in:
Christian Manivong committed 2026-11-01 21:43:09 +01:00
1 parent d78a55dd1a
commit 45f5b65427
3 files changed
+14 -2

No files matched your search

+10
View File
@@ -1940,3 +1940,13 @@ class TestGetSystemConfigBridgeStp:
# Nothing to have an opinion about — distinct from "STP is off".
driver._send_command = _system_send(network_out="network.lan=interface\n")
assert driver.get_system_config()["bridge_stp"] is None
class TestOptionalArgs:
def test_the_callers_optional_args_are_left_as_they_were(self):
optional_args = {"port": 2222, "conn_timeout": 15}
drv = OpenWrtDriver("192.168.1.1", "root", "", optional_args=optional_args)
assert drv.port == 2222
assert optional_args == {"port": 2222, "conn_timeout": 15}