Skip to content

Commit 75686c5

Browse files
committed
Fix last_id in fake service when setting dispatches
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
1 parent 0167906 commit 75686c5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/frequenz/client/dispatch/test/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def set_dispatches(self, microgrid_id: int, value: list[Dispatch]) -> None:
5353
value: The list of dispatches to set.
5454
"""
5555
self._service.dispatches[microgrid_id] = value
56+
# Max between last id and the max id in the list
57+
# pylint: disable=protected-access
58+
self._service._last_id = max(
59+
self._service._last_id, max(dispatch.id for dispatch in value)
60+
)
61+
# pylint: enable=protected-access
5662

5763
@property
5864
def _service(self) -> FakeService:

0 commit comments

Comments
 (0)