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:
89
apps/trading-engine/tests/test_unit_trading_engine.py
Normal file
89
apps/trading-engine/tests/test_unit_trading_engine.py
Normal file
@@ -0,0 +1,89 @@
|
||||
"""Unit tests for trading engine service"""
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
from main import app, Order, Trade, OrderBookEntry
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_app_initialization():
|
||||
"""Test that the FastAPI app initializes correctly"""
|
||||
assert app is not None
|
||||
assert app.title == "AITBC Trading Engine"
|
||||
assert app.version == "1.0.0"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_order_model():
|
||||
"""Test Order model"""
|
||||
order = Order(
|
||||
order_id="order_123",
|
||||
symbol="AITBC/BTC",
|
||||
side="buy",
|
||||
type="limit",
|
||||
quantity=100.0,
|
||||
price=0.00001,
|
||||
user_id="user_123",
|
||||
timestamp=datetime.utcnow()
|
||||
)
|
||||
assert order.order_id == "order_123"
|
||||
assert order.symbol == "AITBC/BTC"
|
||||
assert order.side == "buy"
|
||||
assert order.type == "limit"
|
||||
assert order.quantity == 100.0
|
||||
assert order.price == 0.00001
|
||||
assert order.user_id == "user_123"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_order_model_market_order():
|
||||
"""Test Order model for market order"""
|
||||
order = Order(
|
||||
order_id="order_123",
|
||||
symbol="AITBC/BTC",
|
||||
side="sell",
|
||||
type="market",
|
||||
quantity=50.0,
|
||||
user_id="user_123",
|
||||
timestamp=datetime.utcnow()
|
||||
)
|
||||
assert order.type == "market"
|
||||
assert order.price is None
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_trade_model():
|
||||
"""Test Trade model"""
|
||||
trade = Trade(
|
||||
trade_id="trade_123",
|
||||
symbol="AITBC/BTC",
|
||||
buy_order_id="buy_order_123",
|
||||
sell_order_id="sell_order_123",
|
||||
quantity=100.0,
|
||||
price=0.00001,
|
||||
timestamp=datetime.utcnow()
|
||||
)
|
||||
assert trade.trade_id == "trade_123"
|
||||
assert trade.symbol == "AITBC/BTC"
|
||||
assert trade.buy_order_id == "buy_order_123"
|
||||
assert trade.sell_order_id == "sell_order_123"
|
||||
assert trade.quantity == 100.0
|
||||
assert trade.price == 0.00001
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_order_book_entry_model():
|
||||
"""Test OrderBookEntry model"""
|
||||
entry = OrderBookEntry(
|
||||
price=0.00001,
|
||||
quantity=1000.0,
|
||||
orders_count=5
|
||||
)
|
||||
assert entry.price == 0.00001
|
||||
assert entry.quantity == 1000.0
|
||||
assert entry.orders_count == 5
|
||||
Reference in New Issue
Block a user