def test_set_hybrid(self):
     filename = "c37a3efa-593c-4bab-b49c-bee0613c4fb2"
     expected = "009 survey response for period 2019 sample unit 49900108249D"
     meta_data = MetaWrapper(filename)
     meta_data.set_hybrid(self.test_survey, self.test_bytes)
     actual = meta_data.get_description()
     self.assertEqual(expected, actual)
     self.assertEqual(f'{filename}:hybrid', meta_data.filename)
Esempio n. 2
0
def deliver_hybrid():
    """
    Endpoint for submissions intended for dap and legacy systems. POST request requires the submission JSON to be
    uploaded as "submission", the zipped transformed artifact as "transformed", and the filename passed in the
    query parameters.
    """
    logger.info('Processing Hybrid submission')
    filename = request.args.get("filename")
    meta = MetaWrapper(filename)
    files = request.files
    submission_bytes = files[SUBMISSION_FILE].read()
    survey_dict = json.loads(submission_bytes.decode())
    data_bytes = files[TRANSFORMED_FILE].read()
    meta.set_hybrid(survey_dict)
    return process(meta, data_bytes)