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
72 lines
1.8 KiB
Python
72 lines
1.8 KiB
Python
"""Integration tests for blockchain event bridge."""
|
|
|
|
import pytest
|
|
from unittest.mock import Mock, AsyncMock, patch
|
|
import sys
|
|
|
|
from blockchain_event_bridge.bridge import BlockchainEventBridge
|
|
from blockchain_event_bridge.config import Settings
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_bridge_initialization():
|
|
"""Test bridge initialization."""
|
|
settings = Settings()
|
|
bridge = BlockchainEventBridge(settings)
|
|
|
|
assert bridge.settings == settings
|
|
assert bridge.is_running is False
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_bridge_start_stop():
|
|
"""Test bridge start and stop."""
|
|
settings = Settings(
|
|
subscribe_blocks=False,
|
|
subscribe_transactions=False,
|
|
)
|
|
bridge = BlockchainEventBridge(settings)
|
|
|
|
await bridge.start()
|
|
assert bridge.is_running is True
|
|
|
|
await bridge.stop()
|
|
assert bridge.is_running is False
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_bridge_handle_block_event():
|
|
"""Test bridge handling a block event."""
|
|
settings = Settings(
|
|
enable_coordinator_api_trigger=False,
|
|
enable_marketplace_trigger=False,
|
|
)
|
|
bridge = BlockchainEventBridge(settings)
|
|
|
|
block_data = {
|
|
"height": 100,
|
|
"hash": "0x123",
|
|
"transactions": []
|
|
}
|
|
|
|
# Should not raise an error even without handlers
|
|
await bridge.handle_block_event(block_data)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_bridge_handle_transaction_event():
|
|
"""Test bridge handling a transaction event."""
|
|
settings = Settings(
|
|
enable_agent_daemon_trigger=False,
|
|
enable_coordinator_api_trigger=False,
|
|
)
|
|
bridge = BlockchainEventBridge(settings)
|
|
|
|
tx_data = {
|
|
"hash": "0x456",
|
|
"type": "transfer"
|
|
}
|
|
|
|
# Should not raise an error even without handlers
|
|
await bridge.handle_transaction_event(tx_data)
|