Beispiel #1
0
def test_delete_list(user_client):
    # If result doesn't exist, expect 404
    url = reverse_result_list("doesntexist")
    response = user_client.delete(url, **HTTPS_KWARG)
    validate_response(response, status.HTTP_404_NOT_FOUND)

    # If result does exist, expect 204
    entry_name = create_task_results(1, user_client)

    url = reverse_result_list(entry_name)
    response = user_client.delete(url, **HTTPS_KWARG)
    validate_response(response, status.HTTP_204_NO_CONTENT)
Beispiel #2
0
def test_private_entry_results_list_is_private(
    admin_client, user_client, test_scheduler
):
    entry_name = simulate_frequency_fft_acquisitions(admin_client, is_private=True)
    url = reverse_result_list(entry_name)
    response = user_client.get(url, **HTTPS_KWARG)
    validate_response(response, status.HTTP_403_FORBIDDEN)
Beispiel #3
0
def test_delete_list_data_files_deleted(user_client, test_scheduler):
    entry_name = simulate_frequency_fft_acquisitions(user_client)
    task_result = TaskResult.objects.get(schedule_entry__name=entry_name)
    acquisition = Acquisition.objects.get(task_result__id=task_result.id)
    data_file = acquisition.data.path
    assert os.path.exists(data_file)
    url = reverse_result_list(entry_name)
    response = user_client.delete(url, **HTTPS_KWARG)
    validate_response(response, status.HTTP_204_NO_CONTENT)
    assert not os.path.exists(data_file)
Beispiel #4
0
def test_user_cannot_view_result_list(admin_client, user_client):
    entry_name = create_task_results(1, admin_client)
    url = reverse_result_list(entry_name)
    response = user_client.get(url, **HTTPS_KWARG)
    rjson = validate_response(response, status.HTTP_403_FORBIDDEN)
    return "results" not in rjson