This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-08 17:42:22 -03:00
commit 522bd304e8
22 changed files with 151 additions and 485 deletions

View file

@ -4,7 +4,6 @@ import pytest
from langflow.services.deps import get_storage_service
from langflow.services.storage.service import StorageService
from langflow.services.storage.utils import build_content_type_from_extension
@pytest.fixture
@ -87,10 +86,8 @@ def test_file_operations(client, created_api_key, flow):
assert file_name in response.json()["files"]
# Step 3: Download the file and verify its content
mime_type = build_content_type_from_extension(file_name.split(".")[-1])
response = client.get(
f"api/v1/files/download/{flow_id}/{file_name}", headers=headers
)
response = client.get(f"api/v1/files/download/{flow_id}/{file_name}", headers=headers)
assert response.status_code == 200
assert response.content == file_content
# the headers are application/octet-stream
@ -98,9 +95,7 @@ def test_file_operations(client, created_api_key, flow):
# mime_type is inside media_type
# Step 4: Delete the file
response = client.delete(
f"api/v1/files/delete/{flow_id}/{file_name}", headers=headers
)
response = client.delete(f"api/v1/files/delete/{flow_id}/{file_name}", headers=headers)
assert response.status_code == 200
assert response.json() == {"message": f"File {file_name} deleted successfully"}