Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 9s
Blockchain Synchronization Verification / sync-verification (push) Failing after 1s
CLI Tests / test-cli (push) Failing after 3s
Documentation Validation / validate-docs (push) Successful in 6s
Documentation Validation / validate-policies-strict (push) Successful in 2s
Integration Tests / test-service-integration (push) Successful in 40s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 1s
P2P Network Verification / p2p-verification (push) Successful in 2s
Production Tests / Production Integration Tests (push) Successful in 21s
Python Tests / test-python (push) Successful in 13s
Security Scanning / security-scan (push) Failing after 46s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 17s
Smart Contract Tests / lint-solidity (push) Successful in 10s
- Add sys import to 29 test files across agent-coordinator, blockchain-event-bridge, blockchain-node, and coordinator-api - Remove apps/blockchain-event-bridge/tests/test_integration.py (obsolete bridge integration tests) - Remove apps/coordinator-api/tests/test_integration.py (obsolete API integration tests) - Implement GPU registration in marketplace_gpu.py with GPURegistry model persistence
106 lines
2.7 KiB
Python
106 lines
2.7 KiB
Python
"""Unit tests for agent registry service"""
|
|
|
|
import pytest
|
|
import sys
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
from app import app, Agent, AgentRegistration
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_app_initialization():
|
|
"""Test that the FastAPI app initializes correctly"""
|
|
assert app is not None
|
|
assert app.title == "AITBC Agent Registry API"
|
|
assert app.version == "1.0.0"
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_agent_model():
|
|
"""Test Agent model"""
|
|
agent = Agent(
|
|
id="agent_123",
|
|
name="Test Agent",
|
|
type="trading",
|
|
capabilities=["trading", "analysis"],
|
|
chain_id="ait-devnet",
|
|
endpoint="http://localhost:8000",
|
|
metadata={"region": "us-east"}
|
|
)
|
|
assert agent.id == "agent_123"
|
|
assert agent.name == "Test Agent"
|
|
assert agent.type == "trading"
|
|
assert agent.capabilities == ["trading", "analysis"]
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_agent_model_empty_capabilities():
|
|
"""Test Agent model with empty capabilities"""
|
|
agent = Agent(
|
|
id="agent_123",
|
|
name="Test Agent",
|
|
type="trading",
|
|
capabilities=[],
|
|
chain_id="ait-devnet",
|
|
endpoint="http://localhost:8000"
|
|
)
|
|
assert agent.capabilities == []
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_agent_model_no_metadata():
|
|
"""Test Agent model with default metadata"""
|
|
agent = Agent(
|
|
id="agent_123",
|
|
name="Test Agent",
|
|
type="trading",
|
|
capabilities=["trading"],
|
|
chain_id="ait-devnet",
|
|
endpoint="http://localhost:8000"
|
|
)
|
|
assert agent.metadata == {}
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_agent_registration_model():
|
|
"""Test AgentRegistration model"""
|
|
registration = AgentRegistration(
|
|
name="Test Agent",
|
|
type="trading",
|
|
capabilities=["trading", "analysis"],
|
|
chain_id="ait-devnet",
|
|
endpoint="http://localhost:8000",
|
|
metadata={"region": "us-east"}
|
|
)
|
|
assert registration.name == "Test Agent"
|
|
assert registration.type == "trading"
|
|
assert registration.capabilities == ["trading", "analysis"]
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_agent_registration_model_empty_capabilities():
|
|
"""Test AgentRegistration with empty capabilities"""
|
|
registration = AgentRegistration(
|
|
name="Test Agent",
|
|
type="trading",
|
|
capabilities=[],
|
|
chain_id="ait-devnet",
|
|
endpoint="http://localhost:8000"
|
|
)
|
|
assert registration.capabilities == []
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_agent_registration_model_no_metadata():
|
|
"""Test AgentRegistration with default metadata"""
|
|
registration = AgentRegistration(
|
|
name="Test Agent",
|
|
type="trading",
|
|
capabilities=["trading"],
|
|
chain_id="ait-devnet",
|
|
endpoint="http://localhost:8000"
|
|
)
|
|
assert registration.metadata == {}
|