diff --git a/project/routers/intermediate.py b/project/routers/intermediate.py index ab5a8fe..5e66d07 100644 --- a/project/routers/intermediate.py +++ b/project/routers/intermediate.py @@ -21,6 +21,7 @@ class IntermediateUploadResponse(BaseModel): url: HttpUrl + object_id: uuid.UUID @router.put( @@ -64,6 +65,7 @@ async def submit_intermediate_result_to_hub( ) return IntermediateUploadResponse( + object_id=bucket_file.id, url=str( request.url_for( "retrieve_intermediate_result_from_hub", diff --git a/tests/test_final.py b/tests/test_final.py index 590e003..367cfb1 100644 --- a/tests/test_final.py +++ b/tests/test_final.py @@ -2,13 +2,18 @@ from starlette import status from tests.common.auth import issue_client_access_token, BearerAuth -from tests.common.helpers import next_random_bytes +from tests.common.helpers import next_random_bytes, eventually from tests.common.rest import wrap_bytes_for_request pytestmark = pytest.mark.live def test_200_submit_to_upload(test_client, rng, core_client, analysis_id): + def _check_result_bucket_exists(): + return core_client.get_analysis_bucket(analysis_id, "RESULT") is not None + + assert eventually(_check_result_bucket_exists) + analysis_file_count_old = len(core_client.get_analysis_bucket_file_list().data) blob = next_random_bytes(rng) diff --git a/tests/test_intermediate.py b/tests/test_intermediate.py index f4bd7a5..3e4e1a6 100644 --- a/tests/test_intermediate.py +++ b/tests/test_intermediate.py @@ -5,13 +5,18 @@ from project.routers.intermediate import IntermediateUploadResponse from tests.common.auth import BearerAuth, issue_client_access_token -from tests.common.helpers import next_random_bytes +from tests.common.helpers import next_random_bytes, eventually from tests.common.rest import wrap_bytes_for_request, detail_of pytestmark = pytest.mark.live -def test_200_submit_receive_intermediate(test_client, rng, analysis_id): +def test_200_submit_receive_intermediate(test_client, rng, analysis_id, core_client): + def _check_temp_bucket_exists(): + return core_client.get_analysis_bucket(analysis_id, "TEMP") is not None + + assert eventually(_check_temp_bucket_exists) + blob = next_random_bytes(rng) r = test_client.put( "/intermediate", @@ -23,6 +28,7 @@ def test_200_submit_receive_intermediate(test_client, rng, analysis_id): # check that the response contains a path to a valid resource model = IntermediateUploadResponse(**r.json()) + assert str(model.object_id) in str(model.url.path) r = test_client.get( model.url.path,