"""seed | read — the four drill apps' data through their OWN front doors (fixtures.py, R-156). Tokens are kept in the scratchpad (they can carry generated credentials); the evidence gets only True/False per app.""" import json, sys, os import walk as w, fixtures SUBS = {"wishlist": "c-wish", "navidrome": "c-navi", "romm": "c-romm", "vikunja": "c-vik"} TOK = w.SC + "/seed-tokens.json" mode, label = sys.argv[1], sys.argv[2] w.login() res = {} if mode == "seed": toks = {} for a, sub in SUBS.items(): toks[a] = fixtures.FIXTURES[a].seed(w, sub, w.say) res[a] = toks[a] is not None json.dump(toks, open(TOK, "w"), default=str); os.chmod(TOK, 0o600) else: toks = json.load(open(TOK)) for a, sub in SUBS.items(): if len(sys.argv) > 3 and a not in sys.argv[3].split(","): continue res[a] = bool(toks.get(a)) and fixtures.FIXTURES[a].verify(w, sub, toks[a], w.say) line = f"{label}: {mode} " + " ".join(f"{a}={v}" for a, v in res.items()) w.say(line) open(w.EV + "/C/data-readback.txt", "a").write(line + "\n")