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
79 lines
2.2 KiB
Python
79 lines
2.2 KiB
Python
"""Tests for contract event handlers."""
|
|
|
|
import pytest
|
|
from unittest.mock import Mock, AsyncMock
|
|
import sys
|
|
|
|
from blockchain_event_bridge.action_handlers.agent_daemon import AgentDaemonHandler
|
|
from blockchain_event_bridge.action_handlers.marketplace import MarketplaceHandler
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_agent_daemon_handle_staking_event():
|
|
"""Test agent daemon handler for staking events."""
|
|
handler = AgentDaemonHandler("http://localhost:8006")
|
|
|
|
event_log = {
|
|
"topics": ["StakeCreated"],
|
|
"data": '{"stakeId": "123", "staker": "0xabc"}'
|
|
}
|
|
|
|
# Should not raise an error
|
|
await handler.handle_staking_event(event_log)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_agent_daemon_handle_performance_event():
|
|
"""Test agent daemon handler for performance events."""
|
|
handler = AgentDaemonHandler("http://localhost:8006")
|
|
|
|
event_log = {
|
|
"topics": ["PerformanceVerified"],
|
|
"data": '{"verificationId": "456", "withinSLA": true}'
|
|
}
|
|
|
|
# Should not raise an error
|
|
await handler.handle_performance_event(event_log)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_agent_daemon_handle_bounty_event():
|
|
"""Test agent daemon handler for bounty events."""
|
|
handler = AgentDaemonHandler("http://localhost:8006")
|
|
|
|
event_log = {
|
|
"topics": ["BountyCreated"],
|
|
"data": '{"bountyId": "789", "creator": "0xdef"}'
|
|
}
|
|
|
|
# Should not raise an error
|
|
await handler.handle_bounty_event(event_log)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_agent_daemon_handle_bridge_event():
|
|
"""Test agent daemon handler for bridge events."""
|
|
handler = AgentDaemonHandler("http://localhost:8006")
|
|
|
|
event_log = {
|
|
"topics": ["BridgeInitiated"],
|
|
"data": '{"requestId": "101", "sourceChain": "ethereum"}'
|
|
}
|
|
|
|
# Should not raise an error
|
|
await handler.handle_bridge_event(event_log)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_marketplace_handle_contract_event():
|
|
"""Test marketplace handler for contract events."""
|
|
handler = MarketplaceHandler("http://localhost:8011")
|
|
|
|
event_log = {
|
|
"topics": ["ServiceListed"],
|
|
"data": '{"serviceId": "202", "provider": "0x123"}'
|
|
}
|
|
|
|
# Should not raise an error
|
|
await handler.handle_contract_event(event_log)
|