def test_data_file_created(user_client, test_scheduler): entry_name = simulate_multirec_acquisition(user_client) tr = TaskResult.objects.get(schedule_entry__name=entry_name, task_id=1) acquisitions = Acquisition.objects.filter(task_result=tr) for acquisition in acquisitions: assert acquisition.data assert path.exists(acquisition.data.path) os.remove(acquisition.data.path)
def test_metadata_multirecording_acquisition(user_client, test_scheduler): entry_name = simulate_multirec_acquisition(user_client) tr = TaskResult.objects.get(schedule_entry__name=entry_name, task_id=1) acquisitions = Acquisition.objects.filter(task_result=tr) for acquisition in acquisitions: check_metadata_fields( acquisition, entry_name, SINGLE_TIMEDOMAIN_IQ_MULTI_RECORDING_ACQUISITION, is_multirecording=True, )
def test_multirec_acquisition_archive_download(user_client, test_scheduler): entry_name = simulate_multirec_acquisition(user_client) task_id = 1 url = reverse_archive(entry_name, task_id) disposition = 'attachment; filename="{}_test_multirec_acq_1.sigmf"' disposition = disposition.format(sensor.settings.FQDN) response = user_client.get(url, **HTTPS_KWARG) assert response.status_code == status.HTTP_200_OK assert response["content-disposition"] == disposition assert response["content-type"] == "application/x-tar" with tempfile.NamedTemporaryFile() as tf: for content in response.streaming_content: tf.write(content) sigmf_archive_contents = sigmf.archive.extract(tf.name) assert len(sigmf_archive_contents) == 3
def test_metadata(user_client, test_scheduler): entry_name = simulate_multirec_acquisition(user_client) tr = TaskResult.objects.get(schedule_entry__name=entry_name, task_id=1) acquisitions = Acquisition.objects.filter(task_result=tr) for acquisition in acquisitions: assert sigmf_validate(acquisition.metadata)