Files
troupe-standup/wizard-work/spark/verify_status.py
T

37 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""Verify json_validator.py works correctly."""
import subprocess
import json
# 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)
# 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)