Handle smartcam partial list responses (#1411)

This commit is contained in:
Steven B.
2025-01-06 09:23:46 +00:00
committed by GitHub
parent 1f45f425a0
commit 6aa019280b
4 changed files with 91 additions and 18 deletions

View File

@@ -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
)