def test_cannot_delete_result_details(user_client): """Results are read-only.""" entry_name = create_task_results(1, user_client) url = reverse_result_detail(entry_name, 1) response = user_client.delete(url, **HTTPS_KWARG) validate_response(response, status.HTTP_405_METHOD_NOT_ALLOWED)
def test_cannot_view_private_result_details(user_client, admin_client, test_scheduler): """A user should not be able to view the result of a private task.""" entry_name = simulate_acquisitions(admin_client, is_private=True) url = reverse_result_detail(entry_name, 1) response = user_client.get(url, **HTTPS_KWARG) validate_response(response, status.HTTP_404_NOT_FOUND)
def test_single_result_response(user_client): entry_name = create_task_results(1, user_client) result, = get_result_list(user_client, entry_name) task_id = 1 expected_url = reverse_result_detail(entry_name, task_id) assert result['url'] == expected_url assert result['task_id'] == task_id
def test_multiple_result_response(user_client, test_scheduler): entry_name = create_task_results(3, user_client) results = get_result_list(user_client, entry_name) assert len(results) == 3 for i, acq in enumerate(results, start=1): expected_url = reverse_result_detail(entry_name, i) assert acq['url'] == expected_url assert acq['task_id'] == i
def test_can_view_own_result_details(user_client): """A user should be able to view results they create.""" entry_name = create_task_results(1, user_client) url = reverse_result_detail(entry_name, 1) response = user_client.get(url, **HTTPS_KWARG) validate_response(response, status.HTTP_200_OK)