29 lines
890 B
Python
29 lines
890 B
Python
from perfkit.manifest import Manifest, Sheet, ProjectReport, Page, User, load, dump, manifest_path
|
|
|
|
|
|
def make():
|
|
return Manifest(
|
|
scale=1,
|
|
users={"admin": User("a", "p", 1), "rf": User("r", "p", 2)},
|
|
sheets=[Sheet(1, "RF", "S1", None, 2025, "", 10), Sheet(2, "RF", "S2", "up", 2025, "", 5)],
|
|
project_reports=[ProjectReport(7, 2025, "T", "/x", 3)],
|
|
svods=[Page("svod", "/svod")],
|
|
modal_pages=[Page("m", "/m")],
|
|
)
|
|
|
|
|
|
def test_manifest_roundtrip(tmp_path):
|
|
m = make()
|
|
p = tmp_path / "m.json"
|
|
dump(m, p)
|
|
assert load(p) == m
|
|
|
|
|
|
def test_sheet_url_null_direction():
|
|
assert Sheet.build_url(1, "RF", "S1", None, 2025) == "/table/form/1/form-type/RF/S1/null/2025"
|
|
assert Sheet.build_url(1, "RF", "S1", "up", 2025).endswith("/S1/up/2025")
|
|
|
|
|
|
def test_manifest_path():
|
|
assert manifest_path(6).name == "manifest-s6.json"
|