Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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