import urllib.request
import json
import sys

URL = "http://127.0.0.1:8000"

def test_endpoint(path, expected_status=200):
    try:
        req = urllib.request.Request(URL + path)
        with urllib.request.urlopen(req) as response:
            if response.status == expected_status:
                print(f"✅ {path} returned {response.status}")
                return json.loads(response.read().decode())
            else:
                print(f"❌ {path} returned {response.status}")
    except Exception as e:
        print(f"❌ {path} failed: {e}")

print("Running Manual Module Smoke Tests...")
test_endpoint("/api/v1/manual")
test_endpoint("/api/v1/manual?limit=1")
test_endpoint("/api/v1/manual?search=test")
print("Done!")
