def test_set_dap(self): filename = "c37a3efa-593c-4bab-b49c-bee0613c4fb2" expected = "009 survey response for period 2019 sample unit 49900108249D" meta_data = MetaWrapper(filename) meta_data.set_dap(self.test_survey, self.test_bytes) actual = meta_data.get_description() self.assertEqual(expected, actual) self.assertEqual(f'{filename}:dap', meta_data.filename)
def deliver_dap(): """ Endpoint for submissions only intended for DAP. POST request requires the submission JSON to be uploaded as "submission" and the filename passed in the query parameters. """ logger.info('Processing DAP 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 = submission_bytes meta.set_dap(survey_dict) return process(meta, data_bytes)