mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Handle smartcam partial list responses (#1411)
This commit is contained in:
@@ -33,6 +33,7 @@ class FakeSmartCamTransport(BaseTransport):
|
||||
*,
|
||||
list_return_size=10,
|
||||
is_child=False,
|
||||
get_child_fixtures=True,
|
||||
verbatim=False,
|
||||
components_not_included=False,
|
||||
):
|
||||
@@ -52,9 +53,12 @@ class FakeSmartCamTransport(BaseTransport):
|
||||
self.verbatim = verbatim
|
||||
if not is_child:
|
||||
self.info = copy.deepcopy(info)
|
||||
self.child_protocols = FakeSmartTransport._get_child_protocols(
|
||||
self.info, self.fixture_name, "getChildDeviceList"
|
||||
)
|
||||
# We don't need to get the child fixtures if testing things like
|
||||
# lists
|
||||
if get_child_fixtures:
|
||||
self.child_protocols = FakeSmartTransport._get_child_protocols(
|
||||
self.info, self.fixture_name, "getChildDeviceList"
|
||||
)
|
||||
else:
|
||||
self.info = info
|
||||
# self.child_protocols = self._get_child_protocols()
|
||||
@@ -229,9 +233,16 @@ class FakeSmartCamTransport(BaseTransport):
|
||||
list_key = next(
|
||||
iter([key for key in result if isinstance(result[key], list)])
|
||||
)
|
||||
assert isinstance(params, dict)
|
||||
module_name = next(iter(params))
|
||||
|
||||
start_index = (
|
||||
start_index
|
||||
if (params and (start_index := params.get("start_index")))
|
||||
if (
|
||||
params
|
||||
and module_name
|
||||
and (start_index := params[module_name].get("start_index"))
|
||||
)
|
||||
else 0
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user