Files
aitbc/apps/plugin-marketplace/tests/test_unit_plugin_marketplace.py
aitbc e60cc3226c
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 test files and remove obsolete integration tests
- 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
2026-04-23 16:43:17 +02:00

109 lines
3.0 KiB
Python

"""Unit tests for plugin marketplace service"""
import pytest
import sys
import sys
from pathlib import Path
from main import app, MarketplaceReview, PluginPurchase, DeveloperApplication
@pytest.mark.unit
def test_app_initialization():
"""Test that the FastAPI app initializes correctly"""
assert app is not None
assert app.title == "AITBC Plugin Marketplace"
assert app.version == "1.0.0"
@pytest.mark.unit
def test_marketplace_review_model():
"""Test MarketplaceReview model"""
review = MarketplaceReview(
plugin_id="plugin_123",
user_id="user_123",
rating=5,
title="Great plugin",
content="Excellent functionality",
pros=["Easy to use", "Fast"],
cons=["Learning curve"]
)
assert review.plugin_id == "plugin_123"
assert review.rating == 5
assert review.title == "Great plugin"
assert review.pros == ["Easy to use", "Fast"]
assert review.cons == ["Learning curve"]
@pytest.mark.unit
def test_marketplace_review_defaults():
"""Test MarketplaceReview with default values"""
review = MarketplaceReview(
plugin_id="plugin_123",
user_id="user_123",
rating=4,
title="Good plugin",
content="Nice functionality"
)
assert review.pros == []
assert review.cons == []
@pytest.mark.unit
def test_plugin_purchase_model():
"""Test PluginPurchase model"""
purchase = PluginPurchase(
plugin_id="plugin_123",
user_id="user_123",
price=99.99,
payment_method="credit_card"
)
assert purchase.plugin_id == "plugin_123"
assert purchase.price == 99.99
assert purchase.payment_method == "credit_card"
@pytest.mark.unit
def test_plugin_purchase_negative_price():
"""Test PluginPurchase with negative price"""
purchase = PluginPurchase(
plugin_id="plugin_123",
user_id="user_123",
price=-99.99,
payment_method="credit_card"
)
assert purchase.price == -99.99
@pytest.mark.unit
def test_developer_application_model():
"""Test DeveloperApplication model"""
application = DeveloperApplication(
developer_name="Dev Name",
email="dev@example.com",
company="Dev Corp",
experience="5 years",
portfolio_url="https://portfolio.com",
github_username="devuser",
description="Experienced developer"
)
assert application.developer_name == "Dev Name"
assert application.email == "dev@example.com"
assert application.company == "Dev Corp"
assert application.github_username == "devuser"
@pytest.mark.unit
def test_developer_application_defaults():
"""Test DeveloperApplication with optional fields"""
application = DeveloperApplication(
developer_name="Dev Name",
email="dev@example.com",
experience="3 years",
description="New developer"
)
assert application.company is None
assert application.portfolio_url is None
assert application.github_username is None