scripts/ reorganization: - Sort 14 loose root scripts into subfolders: blockchain/ (genesis, proposer, mock chain, testnet BTC) dev/ (CLI wrapper, dev services, OpenAPI gen, systemd setup, domain proxy) ops/ (coordinator proxy, remote tunnel) gpu/ (miner workflow) - Merge scripts/testing/ into scripts/test/ (eliminate duplicate folder) - Create scripts/examples/ for usage demos and simulations Root-level cleanup: - Move home/ (12 simulation scripts) → scripts/examples/ - Move dev-utils/ (2 files) → scripts/dev/ - Move protocols/receipts/sample → tests/fixtures/ - Delete stale src/ (duplicate of apps/blockchain-node/src/) - Remove empty home/, dev-utils/, protocols/ directories Documentation updates: - Update docs/6_architecture/8_codebase-structure.md tree and table - Update root README.md tree to reflect new structure
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Register test clients for payment integration testing"""
|
|
|
|
import asyncio
|
|
import httpx
|
|
import json
|
|
|
|
# Configuration
|
|
COORDINATOR_URL = "http://127.0.0.1:8000/v1"
|
|
CLIENT_KEY = "test_client_key_123"
|
|
MINER_KEY = "${MINER_API_KEY}"
|
|
|
|
async def register_client():
|
|
"""Register a test client"""
|
|
async with httpx.AsyncClient() as client:
|
|
# Register client
|
|
response = await client.post(
|
|
f"{COORDINATOR_URL}/clients/register",
|
|
headers={"X-API-Key": CLIENT_KEY},
|
|
json={"name": "Test Client", "description": "Client for payment testing"}
|
|
)
|
|
print(f"Client registration: {response.status_code}")
|
|
if response.status_code not in [200, 201]:
|
|
print(f"Response: {response.text}")
|
|
else:
|
|
print("✓ Test client registered successfully")
|
|
|
|
async def register_miner():
|
|
"""Register a test miner"""
|
|
async with httpx.AsyncClient() as client:
|
|
# Register miner
|
|
response = await client.post(
|
|
f"{COORDINATOR_URL}/miners/register",
|
|
headers={"X-API-Key": MINER_KEY},
|
|
json={
|
|
"name": "Test Miner",
|
|
"description": "Miner for payment testing",
|
|
"capacity": 100,
|
|
"price_per_hour": 0.1,
|
|
"hardware": {"gpu": "RTX 4090", "memory": "24GB"}
|
|
}
|
|
)
|
|
print(f"Miner registration: {response.status_code}")
|
|
if response.status_code not in [200, 201]:
|
|
print(f"Response: {response.text}")
|
|
else:
|
|
print("✓ Test miner registered successfully")
|
|
|
|
async def main():
|
|
print("=== Registering Test Clients ===")
|
|
await register_client()
|
|
await register_miner()
|
|
print("\n✅ Test clients registered successfully!")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|