File size: 1,471 Bytes
8fb6272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pytest
import os
import sys
from pathlib import Path

# Adiciona o diretório src ao PYTHONPATH
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))

@pytest.fixture
def sample_video_path():
    """Retorna o caminho para um vídeo de teste"""
    return str(Path(__file__).parent / "fixtures" / "sample_video.mp4")

@pytest.fixture
def mock_weapon_detector_service():
    """Mock do serviço de detecção de armas"""
    class MockWeaponDetectorService:
        def detect(self, video_path, threshold=0.5):
            return {
                "detections": [
                    {"label": "weapon", "confidence": 0.8, "bbox": [10, 10, 100, 100]},
                ],
                "frame_count": 30,
                "processing_time": 1.5
            }
    
    return MockWeaponDetectorService()

@pytest.fixture
def mock_notification_service():
    """Mock do serviço de notificação"""
    class MockNotificationService:
        def send_notification(self, message, level="info"):
            return {"status": "success", "message": message}
    
    return MockNotificationService()

@pytest.fixture
def mock_system_monitor():
    """Mock do monitor de sistema"""
    class MockSystemMonitor:
        def get_system_info(self):
            return {
                "cpu_percent": 50.0,
                "memory_percent": 60.0,
                "gpu_info": {"name": "Test GPU", "memory_used": 1000}
            }
    
    return MockSystemMonitor()