From 3a10f53d765687bcaf345674f4df1a465d28afaa Mon Sep 17 00:00:00 2001 From: spark Date: Wed, 21 Oct 2026 21:12:39 +0000 Subject: [PATCH] spark: add verification script for JSON validator --- wizard-work/spark/verify_status.py | 43 +++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/wizard-work/spark/verify_status.py b/wizard-work/spark/verify_status.py index 406c5fd..4c2928c 100644 --- a/wizard-work/spark/verify_status.py +++ b/wizard-work/spark/verify_status.py @@ -1,14 +1,37 @@ #!/usr/bin/env python3 -"""Verify the hermes_diagnostics output has status 'ok'.""" +"""Verify json_validator.py works correctly.""" +import subprocess import json -import sys -with open("/root/troupe-standup/wizard-work/spark/output.json") as f: - data = json.load(f) +# Test 1: Valid JSON should exit 0 +result = subprocess.run(['python3', '/root/.hermes/wizard-outputs/spark/json_validator.py', + '/root/.hermes/wizard-outputs/spark/test_valid.json'], + capture_output=True, text=True) +if result.returncode != 0: + print("FAIL: Valid JSON should exit 0") + exit(1) +if "VALID" not in result.stdout: + print("FAIL: Expected VALID in output") + exit(1) -if data.get("status") == "ok": - print("VERIFIED: status is ok") - sys.exit(0) -else: - print("FAILED: status is not ok") - sys.exit(1) \ No newline at end of file +# Test 2: Invalid JSON should exit 1 +result = subprocess.run(['python3', '/root/.hermes/wizard-outputs/spark/json_validator.py', + '/root/.hermes/wizard-outputs/spark/test_invalid.json'], + capture_output=True, text=True) +if result.returncode != 1: + print("FAIL: Invalid JSON should exit 1") + exit(1) +if "INVALID" not in result.stdout: + print("FAIL: Expected INVALID in output") + exit(1) + +# Test 3: Non-existent file should exit 1 +result = subprocess.run(['python3', '/root/.hermes/wizard-outputs/spark/json_validator.py', + '/nonexistent/file.json'], + capture_output=True, text=True) +if result.returncode != 1: + print("FAIL: Non-existent file should exit 1") + exit(1) + +print("All verification tests passed!") +exit(0) \ No newline at end of file