Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Nov 26, 2024
1 parent 9b2dc5f commit 9e1cd1c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/test_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ async def test_edit_existing_artifact(minio_server, fastapi_server, test_user_to

# Retrieve and verify the uploaded file
get_url = await artifact_manager.get_file(
artifact_id=dataset.id, path="example.txt"
artifact_id=dataset.id, file_path="example.txt"
)
response = requests.get(get_url)
assert response.status_code == 200
Expand Down Expand Up @@ -1170,7 +1170,8 @@ async def test_artifact_schema_validation(
assert response.ok

# Commit the valid dataset artifact (should succeed as it conforms to the schema)
await artifact_manager.commit(artifact_id=valid_dataset.id)
artifact = await artifact_manager.commit(artifact_id=valid_dataset.id)
assert artifact.file_count == 1

# Confirm the dataset is listed in the collection
items = await artifact_manager.list(parent_id=collection.id)
Expand Down Expand Up @@ -1280,7 +1281,9 @@ async def test_artifact_manager_with_collection(
assert dataset_item["view_count"] == 1

# Retrieve the file in the dataset via HTTP to verify contents
get_url = await artifact_manager.get_file(artifact_id=dataset.id, path="test.txt")
get_url = await artifact_manager.get_file(
artifact_id=dataset.id, file_path="test.txt"
)
response = requests.get(get_url)
assert response.ok
assert response.text == file_content
Expand Down Expand Up @@ -1674,7 +1677,7 @@ async def test_download_count(minio_server, fastapi_server, test_user_token):
# Increment the download count of the artifact by download the primary file
get_url = await artifact_manager.get_file(
artifact_id=artifact.id,
path="example.txt",
file_path="example.txt",
)
response = requests.get(get_url)
assert response.ok
Expand All @@ -1689,7 +1692,7 @@ async def test_download_count(minio_server, fastapi_server, test_user_token):
# download twice will increment the download count by 1
get_url = await artifact_manager.get_file(
artifact_id=artifact.id,
path="example.txt",
file_path="example.txt",
)
response = requests.get(get_url)
assert response.ok
Expand All @@ -1704,14 +1707,14 @@ async def test_download_count(minio_server, fastapi_server, test_user_token):
# If we get the example file in silent mode, the download count won't increment
get_url = await artifact_manager.get_file(
artifact_id=artifact.id,
path="example.txt",
file_path="example.txt",
silent=True,
)
response = requests.get(get_url)
assert response.ok
get_url = await artifact_manager.get_file(
artifact_id=artifact.id,
path="example.txt",
file_path="example.txt",
silent=True,
)
response = requests.get(get_url)
Expand All @@ -1726,7 +1729,7 @@ async def test_download_count(minio_server, fastapi_server, test_user_token):
# download example 2 won't increment the download count
get_url = await artifact_manager.get_file(
artifact_id=artifact.id,
path="example2.txt",
file_path="example2.txt",
)
response = requests.get(get_url)
assert response.ok
Expand Down

0 comments on commit 9e1cd1c

Please sign in to comment.