fix: URL persistence in export + cache-busting v4.8.0
Some checks failed
Build & Push Docker / build (push) Has been cancelled
Some checks failed
Build & Push Docker / build (push) Has been cancelled
- getDocument() now explicitly lists all block fields including url - loadDocument() initializes url/series_id for backward compat with older JSONs - Cache-busting query params (?v=4.8) on all static assets - PDF generator uses block.url directly (proper model field) - Added 7 new URL tests (model, API, PDF link annotations) - Version bumped to 4.8.0
This commit is contained in:
@@ -22,6 +22,7 @@ def test_block_optional_fields():
|
||||
b = Block(date="2026-03-01", start="09:00", end="10:00", title="Test", type_id="ws")
|
||||
assert b.responsible is None
|
||||
assert b.notes is None
|
||||
assert b.url is None
|
||||
assert b.series_id is None
|
||||
|
||||
|
||||
@@ -31,6 +32,26 @@ def test_block_series_id():
|
||||
assert b.series_id == "s_abc123"
|
||||
|
||||
|
||||
def test_block_with_url():
|
||||
b = Block(date="2026-03-01", start="09:00", end="10:00", title="Test", type_id="ws",
|
||||
url="https://example.com/test")
|
||||
assert b.url == "https://example.com/test"
|
||||
|
||||
|
||||
def test_block_url_in_serialization():
|
||||
"""url field must appear in serialized JSON even when None."""
|
||||
b = Block(id="b1", date="2026-03-01", start="09:00", end="10:00",
|
||||
title="Test", type_id="ws")
|
||||
data = b.model_dump(mode="json")
|
||||
assert "url" in data
|
||||
assert data["url"] is None
|
||||
|
||||
b2 = Block(id="b2", date="2026-03-01", start="09:00", end="10:00",
|
||||
title="Test", type_id="ws", url="https://example.com")
|
||||
data2 = b2.model_dump(mode="json")
|
||||
assert data2["url"] == "https://example.com"
|
||||
|
||||
|
||||
def test_block_with_all_fields():
|
||||
b = Block(
|
||||
id="custom-id", date="2026-03-01", start="09:00", end="10:00",
|
||||
|
||||
Reference in New Issue
Block a user