mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-10-25 02:31:30 +00:00
Modern blockchain infrastructure platform with: - Multi-chain RPC endpoints (100+ chains) - Token & NFT APIs (ERC-20, ERC-721, ERC-1155) - Wallet API with portfolio tracking - ERC-4337 Bundler for account abstraction - WebSocket subscriptions - Webhooks for chain events - Hanzo IAM integration for multi-tenant auth (hanzo.id, zoo.id, lux.id, pars.id) - ClickHouse datastore for analytics - Redis MQ for background jobs Pricing: $0.45/M CUs (Alchemy-competitive) - Free: 300M CUs/month - Growth: 400M CUs/month ($49/mo) - Scale: 1.5B CUs/month ($199/mo)
75 lines
2.0 KiB
Python
75 lines
2.0 KiB
Python
"""API tests."""
|
|
|
|
import pytest
|
|
from httpx import AsyncClient, ASGITransport
|
|
|
|
from bootnode.main import app
|
|
|
|
|
|
@pytest.fixture
|
|
async def client():
|
|
"""Create test client."""
|
|
async with AsyncClient(
|
|
transport=ASGITransport(app=app),
|
|
base_url="http://test"
|
|
) as ac:
|
|
yield ac
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_health_check(client: AsyncClient):
|
|
"""Test health check endpoint."""
|
|
response = await client.get("/health")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["status"] == "healthy"
|
|
assert "version" in data
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_root(client: AsyncClient):
|
|
"""Test root endpoint."""
|
|
response = await client.get("/")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["name"] == "Bootnode API"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_list_chains(client: AsyncClient):
|
|
"""Test chains list endpoint."""
|
|
response = await client.get("/v1/chains")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert "chains" in data
|
|
assert "ethereum" in data["chains"]
|
|
assert "polygon" in data["chains"]
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_chain(client: AsyncClient):
|
|
"""Test get specific chain."""
|
|
response = await client.get("/v1/chains/ethereum")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["name"] == "Ethereum"
|
|
assert "mainnet" in data["networks"]
|
|
assert "sepolia" in data["networks"]
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_chain_not_found(client: AsyncClient):
|
|
"""Test get nonexistent chain."""
|
|
response = await client.get("/v1/chains/notachain")
|
|
assert response.status_code == 404
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_rpc_without_auth(client: AsyncClient):
|
|
"""Test RPC endpoint without authentication."""
|
|
response = await client.post(
|
|
"/v1/rpc/ethereum/mainnet",
|
|
json={"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}
|
|
)
|
|
assert response.status_code == 401
|