def GetOperationalStates(self, request, context): """Return the operational states of devices managed by this service.""" res = GetOperationalStatesResponse() if self._get_operational_states_cb is not None: states = self._get_operational_states_cb() res.states.extend(states) return res
def _construct_operational_state_mock(device_id: str) \ -> unittest.mock.Mock: mock = unittest.mock.Mock() future = asyncio.Future() future.set_result( GetOperationalStatesResponse(states=[ State( type="test", deviceID=device_id, value="hello!".encode('utf-8'), ) ])) mock.GetOperationalStates.future.side_effect = [future] return mock