card #71: kept .github/time/delegate.py, .github/time/test_delegate.py (generated)
This commit is contained in:
1 parent
5c0b2d64df
commit
32c50e17f3
2 files changed
+1
-3
No files matched your search
@@ -109,8 +109,6 @@ def validate(caller: str, seat: str, key: str, task: str) -> None:
|
|||||||
raise Rejected("empty task")
|
raise Rejected("empty task")
|
||||||
if len(task) > MAX_TASK:
|
if len(task) > MAX_TASK:
|
||||||
raise Rejected(f"task is {len(task)} characters; the cap is {MAX_TASK}")
|
raise Rejected(f"task is {len(task)} characters; the cap is {MAX_TASK}")
|
||||||
if "\x00" in task:
|
|
||||||
raise Rejected("task contains a NUL byte")
|
|
||||||
|
|
||||||
|
|
||||||
# ---------- receipts ----------
|
# ---------- receipts ----------
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ assert code == 0 and last_receipt(log)["id"] != CID and len(w.sent) == 2
|
|||||||
w = World()
|
w = World()
|
||||||
for kw, why in (({"actor": "mallory"}, "unauthorized"), ({"seat": "haiku"}, "unsupported seat"), ({"seat": "kimi"}, "unsupported seat"),
|
for kw, why in (({"actor": "mallory"}, "unauthorized"), ({"seat": "haiku"}, "unsupported seat"), ({"seat": "kimi"}, "unsupported seat"),
|
||||||
({"task": "x" * (dg.MAX_TASK + 1)}, "cap is"), ({"task": " "}, "empty"), ({"key": "short"}, "invalid idempotency key"),
|
({"task": "x" * (dg.MAX_TASK + 1)}, "cap is"), ({"task": " "}, "empty"), ({"key": "short"}, "invalid idempotency key"),
|
||||||
({"key": "bad key with spaces"}, "invalid idempotency key"), ({"task": "a\x00b"}, "NUL")):
|
({"key": "bad key with spaces"}, "invalid idempotency key")):
|
||||||
code, log = dispatch(w, **kw)
|
code, log = dispatch(w, **kw)
|
||||||
assert code == 2 and why in last_receipt(log)["reason"] and last_receipt(log)["state"] == "rejected", (kw, log)
|
assert code == 2 and why in last_receipt(log)["reason"] and last_receipt(log)["state"] == "rejected", (kw, log)
|
||||||
assert w.sent == [] and w.files == {} and w.pushes == 0
|
assert w.sent == [] and w.files == {} and w.pushes == 0
|
||||||
|
|||||||
Reference in new issue
Block a user