Files
ha-voice-control-mcp/scripts/_test_all.py
T

33 lines
1.1 KiB
Python

"""Quick test: pg_client + dashboard API."""
import os, sys
os.environ["NEO4J_PASSWORD"] = "WaQTUw2t"
os.environ["PG_PASSWORD"] = "WaQTUw2t"
# Test PostgreSQL connectie
from src.pg_client import query
print("PostgreSQL test:")
try:
r = query("SELECT count(*) as cnt FROM dashboard.favorites", fetch="one")
print(f" Favorites: {r['cnt']}")
r2 = query("SELECT count(*) as cnt FROM dashboard.calendar_events", fetch="one")
print(f" Events: {r2['cnt']}")
r3 = query("SELECT count(*) as cnt FROM dashboard.passwords", fetch="one")
print(f" Passwords: {r3['cnt']}")
print(" [OK] PostgreSQL werkt!")
except Exception as e:
print(f" [FOUT] {e}")
# Test Neo4j connectie
print("\nNeo4j test:")
try:
from src.neo4j_client import get_driver, get_all_devices, close
devices = get_all_devices()
print(f" Devices: {len(devices)}")
print(f" Eerste: {devices[0]['ip']} - {devices[0]['hostname']}")
print(" [OK] Neo4j werkt!")
close()
except Exception as e:
print(f" [FOUT] {e}")
print("\nAlle connecties werken. Server kan starten.")