def test_set_legacy(self): filename = "c37a3efa-593c-4bab-b49c-bee0613c4fb2" expected = "009 survey response for period 2019 sample unit 49900108249D" meta_data = MetaWrapper(filename) meta_data.set_legacy(self.test_survey, self.test_bytes) actual = meta_data.get_description() self.assertEqual(expected, actual) self.assertEqual(f'{filename}:ftp', meta_data.filename)
def deliver_legacy(): """ Endpoint for submissions intended for 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 Legacy 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_legacy(survey_dict) return process(meta, data_bytes)