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:
70
apps/simple-explorer/tests/test_unit_simple_explorer.py
Normal file
70
apps/simple-explorer/tests/test_unit_simple_explorer.py
Normal file
@@ -0,0 +1,70 @@
|
||||
"""Unit tests for simple explorer service"""
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch, AsyncMock
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
# Mock httpx before importing
|
||||
sys.modules['httpx'] = Mock()
|
||||
|
||||
from main import app, BLOCKCHAIN_RPC_URL, HTML_TEMPLATE
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_app_initialization():
|
||||
"""Test that the FastAPI app initializes correctly"""
|
||||
assert app is not None
|
||||
assert app.title == "Simple AITBC Explorer"
|
||||
assert app.version == "0.1.0"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_blockchain_rpc_url():
|
||||
"""Test that the blockchain RPC URL is configured"""
|
||||
assert BLOCKCHAIN_RPC_URL == "http://localhost:8025"
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_html_template_exists():
|
||||
"""Test that the HTML template is defined"""
|
||||
assert HTML_TEMPLATE is not None
|
||||
assert "<!DOCTYPE html>" in HTML_TEMPLATE
|
||||
assert "AITBC Blockchain Explorer" in HTML_TEMPLATE
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_html_template_has_search():
|
||||
"""Test that the HTML template has search functionality"""
|
||||
assert "search-input" in HTML_TEMPLATE
|
||||
assert "performSearch()" in HTML_TEMPLATE
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_html_template_has_blocks_section():
|
||||
"""Test that the HTML template has blocks section"""
|
||||
assert "Latest Blocks" in HTML_TEMPLATE
|
||||
assert "blocks-list" in HTML_TEMPLATE
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_html_template_has_results_section():
|
||||
"""Test that the HTML template has results section"""
|
||||
assert "Transaction Details" in HTML_TEMPLATE
|
||||
assert "tx-details" in HTML_TEMPLATE
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_html_template_has_tailwind():
|
||||
"""Test that the HTML template includes Tailwind CSS"""
|
||||
assert "tailwindcss" in HTML_TEMPLATE
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_html_template_format_timestamp_function():
|
||||
"""Test that the HTML template has formatTimestamp function"""
|
||||
assert "formatTimestamp" in HTML_TEMPLATE
|
||||
assert "toLocaleString" in HTML_TEMPLATE
|
||||
Reference in New Issue
Block a user