Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@
"source.organizeImports": "explicit"
}
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"typescript",
"typescriptreact"
],
"prettier.requireConfig": true,
"files.eol": "\n",
"python.testing.pytestArgs": ["backend"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.analysis.typeCheckingMode": "strict",
"python.analysis.extraPaths": ["${workspaceFolder}/backend"],
}
"python.testing.pytestArgs": ["."],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.analysis.typeCheckingMode": "strict",
"python.analysis.extraPaths": ["${workspaceFolder}/backend"]
}
7 changes: 6 additions & 1 deletion backend/app/api/routers/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ async def ingest_file(
session: Session = Depends(get_db),
) -> JobResponse:
assert user_id
allowed_content_types: list[str] = ["image/jpeg", "image/png", "application/pdf"]
allowed_content_types: list[str] = [
"image/jpeg",
"image/png",
"application/pdf",
"text/plain",
]
content_type: str | None = file.content_type
if content_type is None:
raise HTTPException(status_code=400, detail="No valid file content type")
Expand Down
21 changes: 20 additions & 1 deletion backend/tests/test_api/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,32 @@ def test_ingest_file_invalid_content_type(
) -> None:
"""Test file ingestion fails with invalid content type."""
file_content = b"fake content"
files = {"file": ("test.txt", file_content, "text/plain")}
files = {"file": ("test.json", file_content, "application/json")}

response = client.post("/tasks/ingest/file", files=files)

assert response.status_code == 400
assert "Invalid file content type" in response.json()["detail"]

@patch("app.api.routers.tasks.ingest_file_task")
def test_ingest_txt_content_type(
self,
mock_ingest_task: MagicMock,
client: TestClient,
mock_user_id: int,
) -> None:
"""Test file ingestion fails with invalid content type."""
mock_job = MagicMock()
mock_job.id = "test-job-id-txt"
mock_ingest_task.delay.return_value = mock_job

file_content = b"fake content"
files = {"file": ("test.txt", file_content, "text/plain")}

response = client.post("/tasks/ingest/file", files=files)

assert response.status_code == 200

@patch("app.api.routers.tasks.ingest_file_task")
def test_ingest_file_png_success(
self,
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.5.9",
"eslint-plugin-react-hooks": "^7.0.1",
"prettier": "^3.7.4",
"tailwindcss": "^4",
"tw-animate-css": "^1.4.0",
Expand Down
Loading