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
102 lines
2.9 KiB
Python
102 lines
2.9 KiB
Python
"""Unit tests for plugin registry service"""
|
|
|
|
import pytest
|
|
import sys
|
|
import sys
|
|
from pathlib import Path
|
|
from datetime import datetime
|
|
|
|
|
|
from main import app, PluginRegistration, PluginVersion, SecurityScan
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_app_initialization():
|
|
"""Test that the FastAPI app initializes correctly"""
|
|
assert app is not None
|
|
assert app.title == "AITBC Plugin Registry"
|
|
assert app.version == "1.0.0"
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_plugin_registration_model():
|
|
"""Test PluginRegistration model"""
|
|
plugin = PluginRegistration(
|
|
name="Test Plugin",
|
|
version="1.0.0",
|
|
description="A test plugin",
|
|
author="Test Author",
|
|
category="testing",
|
|
tags=["test", "demo"],
|
|
repository_url="https://github.com/test/plugin",
|
|
homepage_url="https://test.com",
|
|
license="MIT",
|
|
dependencies=["dependency1"],
|
|
aitbc_version="1.0.0",
|
|
plugin_type="cli"
|
|
)
|
|
assert plugin.name == "Test Plugin"
|
|
assert plugin.version == "1.0.0"
|
|
assert plugin.author == "Test Author"
|
|
assert plugin.category == "testing"
|
|
assert plugin.tags == ["test", "demo"]
|
|
assert plugin.license == "MIT"
|
|
assert plugin.plugin_type == "cli"
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_plugin_registration_defaults():
|
|
"""Test PluginRegistration default values"""
|
|
plugin = PluginRegistration(
|
|
name="Test Plugin",
|
|
version="1.0.0",
|
|
description="A test plugin",
|
|
author="Test Author",
|
|
category="testing",
|
|
tags=[],
|
|
repository_url="https://github.com/test/plugin",
|
|
license="MIT",
|
|
aitbc_version="1.0.0",
|
|
plugin_type="cli"
|
|
)
|
|
assert plugin.homepage_url is None
|
|
assert plugin.dependencies == []
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_plugin_version_model():
|
|
"""Test PluginVersion model"""
|
|
version = PluginVersion(
|
|
version="1.0.0",
|
|
changelog="Initial release",
|
|
download_url="https://github.com/test/plugin/archive/v1.0.0.tar.gz",
|
|
checksum="abc123",
|
|
aitbc_compatibility=["1.0.0", "1.1.0"],
|
|
release_date=datetime.utcnow()
|
|
)
|
|
assert version.version == "1.0.0"
|
|
assert version.changelog == "Initial release"
|
|
assert version.download_url == "https://github.com/test/plugin/archive/v1.0.0.tar.gz"
|
|
assert version.checksum == "abc123"
|
|
assert version.aitbc_compatibility == ["1.0.0", "1.1.0"]
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_security_scan_model():
|
|
"""Test SecurityScan model"""
|
|
scan = SecurityScan(
|
|
scan_id="scan_123",
|
|
plugin_id="test_plugin",
|
|
version="1.0.0",
|
|
scan_date=datetime.utcnow(),
|
|
vulnerabilities=[{"severity": "low", "description": "Test"}],
|
|
risk_score="low",
|
|
passed=True
|
|
)
|
|
assert scan.scan_id == "scan_123"
|
|
assert scan.plugin_id == "test_plugin"
|
|
assert scan.version == "1.0.0"
|
|
assert scan.risk_score == "low"
|
|
assert scan.passed is True
|
|
assert len(scan.vulnerabilities) == 1
|