175 lines
5.8 KiB
Python
175 lines
5.8 KiB
Python
"""
|
|
Import verification tests for services reorganization.
|
|
|
|
These tests verify that all import paths work correctly after
|
|
moving service files into subdirectories.
|
|
"""
|
|
import pytest
|
|
|
|
|
|
# ============================================================
|
|
# New import path tests (should work after reorganization)
|
|
# ============================================================
|
|
|
|
class TestDiagnosisImports:
|
|
"""Verify diagnosis subdirectory imports."""
|
|
|
|
def test_geo_diagnosis_import(self):
|
|
from app.services.diagnosis.geo_diagnosis import GEODiagnosisService
|
|
assert GEODiagnosisService is not None
|
|
|
|
def test_geo_diagnosis_dataclasses(self):
|
|
from app.services.diagnosis.geo_diagnosis import (
|
|
GEODiagnosisInput,
|
|
GEODiagnosisResult,
|
|
GEODimensionScore,
|
|
GEORecommendation,
|
|
DiagnosisItem,
|
|
)
|
|
assert GEODiagnosisInput is not None
|
|
assert GEODiagnosisResult is not None
|
|
|
|
def test_seo_diagnosis_import(self):
|
|
from app.services.diagnosis.seo_diagnosis import SEODiagnosisService
|
|
assert SEODiagnosisService is not None
|
|
|
|
def test_seo_diagnosis_dataclasses(self):
|
|
from app.services.diagnosis.seo_diagnosis import (
|
|
SEODiagnosisResult,
|
|
SEODimensionScore,
|
|
SEORecommendation,
|
|
DiagnosisStatus,
|
|
DimensionName,
|
|
)
|
|
assert SEODiagnosisResult is not None
|
|
assert DiagnosisStatus is not None
|
|
|
|
|
|
class TestScoringImports:
|
|
"""Verify scoring subdirectory imports."""
|
|
|
|
def test_scoring_service_import(self):
|
|
from app.services.scoring.scoring_service import ScoringService
|
|
assert ScoringService is not None
|
|
|
|
def test_scoring_dataclasses(self):
|
|
from app.services.scoring.scoring_service import (
|
|
ScoringResultV2,
|
|
DimensionScore,
|
|
)
|
|
assert ScoringResultV2 is not None
|
|
assert DimensionScore is not None
|
|
|
|
def test_get_health_level_reexport(self):
|
|
"""scoring_service re-exports get_health_level from app.utils.health"""
|
|
from app.services.scoring.scoring_service import get_health_level
|
|
assert callable(get_health_level)
|
|
|
|
|
|
class TestAlertImports:
|
|
"""Verify alert subdirectory imports."""
|
|
|
|
def test_alert_engine_import(self):
|
|
from app.services.alert.alert_engine import AlertEngine
|
|
assert AlertEngine is not None
|
|
|
|
def test_alert_context_import(self):
|
|
from app.services.alert.alert_engine import AlertContext
|
|
assert AlertContext is not None
|
|
|
|
|
|
class TestCitationImports:
|
|
"""Verify citation subdirectory imports."""
|
|
|
|
def test_citation_import(self):
|
|
from app.services.citation.citation import get_citations
|
|
assert callable(get_citations)
|
|
|
|
def test_citation_stats_import(self):
|
|
from app.services.citation.citation import get_citation_stats
|
|
assert callable(get_citation_stats)
|
|
|
|
def test_citation_pattern_import(self):
|
|
from app.services.citation.citation_pattern import CitationPatternEngine
|
|
assert CitationPatternEngine is not None
|
|
|
|
def test_citation_pattern_dataclasses(self):
|
|
from app.services.citation.citation_pattern import (
|
|
CitationPattern,
|
|
PatternAnalysisReport,
|
|
)
|
|
assert CitationPattern is not None
|
|
assert PatternAnalysisReport is not None
|
|
|
|
|
|
class TestLLMImports:
|
|
"""Verify llm subdirectory imports (new additions)."""
|
|
|
|
def test_smart_router_import(self):
|
|
from app.services.llm.smart_router import SmartRouter
|
|
assert SmartRouter is not None
|
|
|
|
def test_engine_selector_import(self):
|
|
from app.services.llm.engine_selector import EngineSelector
|
|
assert EngineSelector is not None
|
|
|
|
def test_smart_router_dataclasses(self):
|
|
from app.services.llm.smart_router import (
|
|
CostTier,
|
|
EngineCostProfile,
|
|
ENGINE_COST_PROFILES,
|
|
)
|
|
assert CostTier is not None
|
|
assert ENGINE_COST_PROFILES is not None
|
|
|
|
def test_llm_init_includes_new_exports(self):
|
|
"""Verify llm/__init__.py includes SmartRouter and EngineSelector."""
|
|
from app.services.llm import SmartRouter, EngineSelector
|
|
assert SmartRouter is not None
|
|
assert EngineSelector is not None
|
|
|
|
|
|
class TestDetectionImports:
|
|
"""Verify detection subdirectory imports."""
|
|
|
|
def test_detection_scheduler_import(self):
|
|
from app.services.detection.detection_scheduler import DetectionSchedulerService
|
|
assert DetectionSchedulerService is not None
|
|
|
|
def test_task_not_found_error_import(self):
|
|
from app.services.detection.detection_scheduler import TaskNotFoundError
|
|
assert TaskNotFoundError is not None
|
|
|
|
|
|
class TestAdvisorImports:
|
|
"""Verify advisor subdirectory imports."""
|
|
|
|
def test_optimization_advisor_import(self):
|
|
from app.services.advisor.optimization_advisor import generate_suggestions
|
|
assert callable(generate_suggestions)
|
|
|
|
def test_advisor_dataclasses(self):
|
|
from app.services.advisor.optimization_advisor import (
|
|
SuggestionItem,
|
|
BrandAnalysisContext,
|
|
)
|
|
assert SuggestionItem is not None
|
|
assert BrandAnalysisContext is not None
|
|
|
|
|
|
class TestAnalysisImports:
|
|
"""Verify analysis subdirectory imports."""
|
|
|
|
def test_sentiment_service_import(self):
|
|
from app.services.analysis.sentiment_service import SentimentAnalysisService
|
|
assert SentimentAnalysisService is not None
|
|
|
|
def test_sentiment_result_import(self):
|
|
from app.services.analysis.sentiment_service import SentimentResult
|
|
assert SentimentResult is not None
|
|
|
|
def test_get_sentiment_service_import(self):
|
|
from app.services.analysis.sentiment_service import get_sentiment_service
|
|
assert callable(get_sentiment_service)
|
|
|