forked from genewildish/Mainline
- Delete engine/controller.py (StreamController - deprecated) - Delete engine/mic.py (MicMonitor - deprecated) - Delete tests/test_controller.py (was testing removed legacy code) - Delete tests/test_mic.py (was testing removed legacy code) - Update tests/test_emitters.py to test MicSensor instead of MicMonitor - Clean up pipeline.py introspector to remove StreamController reference - Update AGENTS.md to reflect architecture changes
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
"""
|
|
Tests for engine.emitters module.
|
|
"""
|
|
|
|
from engine.emitters import EventEmitter, Startable, Stoppable
|
|
|
|
|
|
class TestEventEmitterProtocol:
|
|
"""Tests for EventEmitter protocol."""
|
|
|
|
def test_protocol_exists(self):
|
|
"""EventEmitter protocol is defined."""
|
|
assert EventEmitter is not None
|
|
|
|
def test_protocol_has_subscribe_method(self):
|
|
"""EventEmitter has subscribe method in protocol."""
|
|
assert hasattr(EventEmitter, "subscribe")
|
|
|
|
def test_protocol_has_unsubscribe_method(self):
|
|
"""EventEmitter has unsubscribe method in protocol."""
|
|
assert hasattr(EventEmitter, "unsubscribe")
|
|
|
|
|
|
class TestStartableProtocol:
|
|
"""Tests for Startable protocol."""
|
|
|
|
def test_protocol_exists(self):
|
|
"""Startable protocol is defined."""
|
|
assert Startable is not None
|
|
|
|
def test_protocol_has_start_method(self):
|
|
"""Startable has start method in protocol."""
|
|
assert hasattr(Startable, "start")
|
|
|
|
|
|
class TestStoppableProtocol:
|
|
"""Tests for Stoppable protocol."""
|
|
|
|
def test_protocol_exists(self):
|
|
"""Stoppable protocol is defined."""
|
|
assert Stoppable is not None
|
|
|
|
def test_protocol_has_stop_method(self):
|
|
"""Stoppable has stop method in protocol."""
|
|
assert hasattr(Stoppable, "stop")
|
|
|
|
|
|
class TestProtocolCompliance:
|
|
"""Tests that existing classes comply with protocols."""
|
|
|
|
def test_ntfy_poller_complies_with_protocol(self):
|
|
"""NtfyPoller implements EventEmitter protocol."""
|
|
from engine.ntfy import NtfyPoller
|
|
|
|
poller = NtfyPoller("http://example.com/topic")
|
|
assert hasattr(poller, "subscribe")
|
|
assert hasattr(poller, "unsubscribe")
|
|
assert callable(poller.subscribe)
|
|
assert callable(poller.unsubscribe)
|
|
|
|
def test_mic_sensor_complies_with_protocol(self):
|
|
"""MicSensor implements Startable and Stoppable protocols."""
|
|
from engine.sensors.mic import MicSensor
|
|
|
|
sensor = MicSensor()
|
|
assert hasattr(sensor, "start")
|
|
assert hasattr(sensor, "stop")
|
|
assert callable(sensor.start)
|
|
assert callable(sensor.stop)
|