Skip to content

Commit

Permalink
Properly await the now async _verify_source_file_access
Browse files Browse the repository at this point in the history
  • Loading branch information
dmannarino committed Dec 30, 2023
1 parent f31ea77 commit 3e775cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/routes/datasets/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async def add_new_version(
input_data = request.dict(exclude_none=True, by_alias=True)
creation_options = input_data.pop("creation_options")

_verify_source_file_access(creation_options["source_uri"])
await _verify_source_file_access(creation_options["source_uri"])

# TODO: Do more to verify that any specified options are valid for
# the actual source file. For example, check any specified schema
Expand Down Expand Up @@ -217,7 +217,7 @@ async def append_to_version(
files.
"""
dataset, version = dv
_verify_source_file_access(request.dict()["source_uri"])
await _verify_source_file_access(request.dict()["source_uri"])

default_asset: ORMAsset = await assets.get_default_asset(dataset, version)

Expand Down
6 changes: 3 additions & 3 deletions tests_v2/unit/app/routes/datasets/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tests_v2.fixtures.creation_options.versions import VECTOR_SOURCE_CREATION_OPTIONS
from tests_v2.fixtures.metadata.version import VERSION_METADATA
from tests_v2.unit.app.routes.utils import assert_jsend
from tests_v2.utils import BatchJobMock, void_function
from tests_v2.utils import BatchJobMock, void_coroutine


@pytest.mark.asyncio
Expand Down Expand Up @@ -81,7 +81,7 @@ async def test_create_version_bare_minimum(
# patch all functions which reach out to external services
batch_job_mock = BatchJobMock()
monkeypatch.setattr(batch, "submit_batch_job", batch_job_mock.submit_batch_job)
monkeypatch.setattr(versions, "_verify_source_file_access", void_function)
monkeypatch.setattr(versions, "_verify_source_file_access", void_coroutine)

payload = {"creation_options": VECTOR_SOURCE_CREATION_OPTIONS}

Expand All @@ -102,7 +102,7 @@ async def test_append_version_bare_minimum(
# patch all functions which reach out to external services
batch_job_mock = BatchJobMock()
monkeypatch.setattr(batch, "submit_batch_job", batch_job_mock.submit_batch_job)
monkeypatch.setattr(versions, "_verify_source_file_access", void_function)
monkeypatch.setattr(versions, "_verify_source_file_access", void_coroutine)

payload = {"source_uri": ["s3://some_bucket/test.shp.zip"]}

Expand Down

0 comments on commit 3e775cf

Please sign in to comment.