def test_stripped_headers(): request = daq_store.StoreImageRequest() request.header.client_name = "my_client" request.image.image.data = bytes("mybytes", 'utf-8') request.image.image.cols = 21 response = daq_store.StoreImageResponse() populate_response_header(response, request) assert response.header.request_header.client_name == "my_client" req_unpacked = daq_store.StoreImageRequest() response.header.request.Unpack(req_unpacked) assert req_unpacked.image.image.cols == 21 assert len(req_unpacked.image.image.data) == 0 # check that the original request is unchanged. assert len(request.image.image.data) > 0
def store_image_async(self, image, data_id, **kwargs): """Async version of the store_image() RPC.""" request = data_acquisition_store.StoreImageRequest(image=image, data_id=data_id) return self.call_async(self._stub.StoreImage, request, error_from_response=common_header_errors, **kwargs)
def test_strip_large_bytes(): req = daq_store.StoreImageRequest() temp_data = bytes("mybytes", 'utf-8') req.image.image.data = temp_data req.image.image.cols = 21 assert len(req.image.image.data) > 0 assert req.image.image.cols == 21 stripped_req = strip_large_bytes_fields(req) # Check the stripped request. assert len(req.image.image.data) == 0 assert req.image.image.cols == 21
def store_image(self, image, data_id, **kwargs): """Store image. Args: image (bosdyn.api.ImageCapture) : Image to store. data_id (bosdyn.api.DataIdentifier) : Data identifier to use for storing the image. Returns: StoreImageResponse response. """ request = data_acquisition_store.StoreImageRequest(image=image, data_id=data_id) return self.call(self._stub.StoreImage, request, error_from_response=common_header_errors, **kwargs)