Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Changed
- **README**: package count corrected to 33 (lockstep TS + Python families, including TypeScript-only `webhook` and `events`).

### Added

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new heading sits directly above the existing isolated-tier paragraph, so that paragraph now reads as part of the test note. Place this subsection after that paragraph so the two stay separate.

- **Python server**: direct unit tests for `check_body_limit` Content-Length branches (missing, non-numeric, negative, equal to the cap, and over the cap).

Adds a third storage tier, `"isolated"`, to `starfish-replica`'s space-mirror
channel: a collection whose node is sealed under its OWN per-node keyring
rather than the space-wide one, so access can be granted and revoked one node
Expand Down
33 changes: 33 additions & 0 deletions packages/python/server/tests/router/test_body_limit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Direct unit tests for check_body_limit Content-Length branches."""

import json

import pytest
from fastapi.responses import JSONResponse

from starfish_server.router.middleware import check_body_limit


@pytest.mark.parametrize(
("content_length", "status_code", "error"),
[
(None, None, None),
("abc", 400, "Invalid Content-Length"),
("1.5", 400, "Invalid Content-Length"),
("-1", 400, "Invalid Content-Length"),
("100", None, None),
("101", 413, "Payload too large"),
],
)
def test_check_body_limit_content_length(
content_length: str | None,
status_code: int | None,
error: str | None,
) -> None:
result = check_body_limit(content_length, 100)
if status_code is None:
assert result is None
return
assert isinstance(result, JSONResponse)
assert result.status_code == status_code
assert json.loads(result.body) == {"error": error}
Loading