Add sys import to test files and remove obsolete integration tests
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
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
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
"""Unit tests for exchange integration service"""
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
|
||||
# Mock aiohttp before importing
|
||||
sys.modules['aiohttp'] = Mock()
|
||||
|
||||
from main import app, ExchangeRegistration, TradingPair, OrderRequest
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_app_initialization():
|
||||
"""Test that the FastAPI app initializes correctly"""
|
||||
assert app is not None
|
||||
assert app.title == "AITBC Exchange Integration Service"
|
||||
assert app.version == "1.0.0"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_exchange_registration_model():
|
||||
"""Test ExchangeRegistration model"""
|
||||
registration = ExchangeRegistration(
|
||||
name="TestExchange",
|
||||
api_key="test_key_123",
|
||||
sandbox=True,
|
||||
description="Test exchange"
|
||||
)
|
||||
assert registration.name == "TestExchange"
|
||||
assert registration.api_key == "test_key_123"
|
||||
assert registration.sandbox is True
|
||||
assert registration.description == "Test exchange"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_exchange_registration_defaults():
|
||||
"""Test ExchangeRegistration default values"""
|
||||
registration = ExchangeRegistration(
|
||||
name="TestExchange",
|
||||
api_key="test_key_123"
|
||||
)
|
||||
assert registration.name == "TestExchange"
|
||||
assert registration.api_key == "test_key_123"
|
||||
assert registration.sandbox is True
|
||||
assert registration.description is None
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_trading_pair_model():
|
||||
"""Test TradingPair model"""
|
||||
pair = TradingPair(
|
||||
symbol="AITBC/BTC",
|
||||
base_asset="AITBC",
|
||||
quote_asset="BTC",
|
||||
min_order_size=0.001,
|
||||
price_precision=8,
|
||||
quantity_precision=6
|
||||
)
|
||||
assert pair.symbol == "AITBC/BTC"
|
||||
assert pair.base_asset == "AITBC"
|
||||
assert pair.quote_asset == "BTC"
|
||||
assert pair.min_order_size == 0.001
|
||||
assert pair.price_precision == 8
|
||||
assert pair.quantity_precision == 6
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_order_request_model():
|
||||
"""Test OrderRequest model"""
|
||||
order = OrderRequest(
|
||||
symbol="AITBC/BTC",
|
||||
side="buy",
|
||||
type="limit",
|
||||
quantity=100.0,
|
||||
price=0.00001
|
||||
)
|
||||
assert order.symbol == "AITBC/BTC"
|
||||
assert order.side == "buy"
|
||||
assert order.type == "limit"
|
||||
assert order.quantity == 100.0
|
||||
assert order.price == 0.00001
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_order_request_market_order():
|
||||
"""Test OrderRequest for market order"""
|
||||
order = OrderRequest(
|
||||
symbol="AITBC/BTC",
|
||||
side="sell",
|
||||
type="market",
|
||||
quantity=50.0
|
||||
)
|
||||
assert order.symbol == "AITBC/BTC"
|
||||
assert order.side == "sell"
|
||||
assert order.type == "market"
|
||||
assert order.quantity == 50.0
|
||||
assert order.price is None
|
||||
Reference in New Issue
Block a user