def test_download_data(): """ Not implemented """ # Fake answer definition httpretty.register_uri( httpretty.GET, 'http://%s:%s/TemporalDataManagerWebApp/webapi/processdata/id/download/1' % (TEST_HOST, TEST_PORT), status=200) ntdm = NonTemporalDataMgr() ntdm.download_data("1")
def read(process_data_id): """ Reads the data blob content: for the unique process_data row identified by id. :param process_data_id: the id key of the raw process_data to get data from :return: the content data stored. :rtype: bytes or str or object :raise IkatsNotFoundError: no resource identified by ID :raise IkatsException: failed to read """ response = None try: ntdm = NonTemporalDataMgr() response = ntdm.download_data(process_data_id) if response.status == 200: # Reads the data returned by the service. # default_content is only used if the content_type is unknown by RestClientResponse return response.get_appropriate_content( default_content=response.text) elif response.status == 404: msg = "IkatsProcessData::read({}) resource not found : HTTP response={}" raise IkatsNotFoundError(msg.format(process_data_id, response)) else: msg = "IkatsProcessData::read({}) failed : HTTP response={}" raise IkatsException(msg.format(process_data_id, response)) except IkatsException: raise except Exception as exception: msg = "IkatsProcessData::read({}) failed : unexpected error. got response={}" raise IkatsException(msg.format(exception, response))