O3: task sources and result sinks (#11)
This commit was merged in pull request #11.
This commit is contained in:
1 parent
2f79b69977
commit
afafc41376
10 files changed
+594
-76
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fake cmd adapter for tests/e2e.py. State/log in $ADAPTER_DIR. Implements the protocol in docs/cmd-protocol.md."""
|
||||
import json, os, sys
|
||||
|
||||
d = os.environ["ADAPTER_DIR"]
|
||||
op = sys.argv[1]
|
||||
data = json.load(sys.stdin)
|
||||
open(f"{d}/calls.log", "a").write(json.dumps({"op": op, "in": data}) + "\n")
|
||||
if os.environ.get("BREAK") == op:
|
||||
print("not json")
|
||||
sys.exit(0)
|
||||
if op == "list":
|
||||
out = {"tasks": [
|
||||
{"id": "t-good", "title": "Good", "body": "WRITE", "repo": os.environ["REPO"], "number": 7},
|
||||
{"id": "t-taken", "title": "Taken", "body": "WRITE", "repo": os.environ["REPO"]},
|
||||
{"id": "t-bad", "title": "Bad", "body": "FAIL", "repo": os.environ["REPO"]},
|
||||
]}
|
||||
elif op == "claim":
|
||||
out = {"claimed": data["task"]["id"] != "t-taken"}
|
||||
elif op == "publish":
|
||||
out = {"url": "http://example/pr/1"}
|
||||
else:
|
||||
out = {}
|
||||
print(json.dumps(out))
|
||||
Reference in new issue
Block a user