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
94 lines
2.3 KiB
Python
94 lines
2.3 KiB
Python
"""Integration tests for exchange service"""
|
|
|
|
import pytest
|
|
import sys
|
|
import sys
|
|
from pathlib import Path
|
|
from fastapi.testclient import TestClient
|
|
from unittest.mock import patch, MagicMock
|
|
|
|
|
|
# Mock database initialization to avoid creating real database
|
|
@pytest.fixture(autouse=True)
|
|
def mock_database():
|
|
"""Mock database initialization"""
|
|
with patch('exchange_api.init_db'):
|
|
with patch('exchange_api.get_db_session') as mock_get_db:
|
|
mock_session = MagicMock()
|
|
mock_get_db.return_value = mock_session
|
|
yield
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_health_check():
|
|
"""Test health check endpoint"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
response = client.get("/api/health")
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert data["status"] == "ok"
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_login_user():
|
|
"""Test user login endpoint"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires database, skip in unit tests
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_logout_user():
|
|
"""Test user logout endpoint"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires authentication, skip in unit tests
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_get_recent_trades():
|
|
"""Test getting recent trades"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires database, skip in unit tests
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_get_orders():
|
|
"""Test getting orders"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires database, skip in unit tests
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_get_my_orders():
|
|
"""Test getting my orders"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires authentication and database, skip in unit tests
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_get_orderbook():
|
|
"""Test getting order book"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires database, skip in unit tests
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_create_order():
|
|
"""Test creating an order"""
|
|
from exchange_api import app
|
|
client = TestClient(app)
|
|
# This endpoint requires authentication and database, skip in unit tests
|
|
pass
|