def create_set_request(self, address_data_map): entries = [ Entry(address=address, data=data) for address, data in address_data_map.items() ] return TpStateSetRequest(entries=entries)
def create_set_request(self, address_data_map): self._validate_addresses( [address for address, _ in address_data_map.items()]) entries = [ TpStateEntry(address=address, data=data) for address, data in address_data_map.items() ] return TpStateSetRequest(entries=entries)
def test_state_set(self): """Tests that State sets addresses correctly.""" self.mock_stream.send.return_value = self._make_future( message_type=Message.TP_STATE_SET_RESPONSE, content=TpStateSetResponse( status=TpStateSetResponse.OK, addresses=self.addresses).SerializeToString()) self.context.set_state(self._make_entries(protobuf=False)) self.mock_stream.send.assert_called_with( Message.TP_STATE_SET_REQUEST, TpStateSetRequest( context_id=self.context_id, entries=self._make_entries()).SerializeToString())