fix: add summary fallback and stabilize recording sink
This commit is contained in:
@@ -9,6 +9,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
import discord
|
||||
|
||||
import bot
|
||||
import voice
|
||||
|
||||
|
||||
class FakeChannel:
|
||||
@@ -66,3 +67,42 @@ def test_build_retry_notice_mentions_reason_and_path():
|
||||
assert "OpenRouter 502" in message
|
||||
assert "meeting.wav" in message
|
||||
assert "`/retry`" in message
|
||||
|
||||
|
||||
def test_meeting_recorder_wraps_wave_sink_with_silence_generator(tmp_path, monkeypatch):
|
||||
created = {}
|
||||
|
||||
class FakeWaveSink:
|
||||
def __init__(self, output_path):
|
||||
self.output_path = output_path
|
||||
created["wave"] = self
|
||||
|
||||
class FakeSilenceGeneratorSink:
|
||||
def __init__(self, destination):
|
||||
self.destination = destination
|
||||
created["silence"] = self
|
||||
|
||||
class FakeVoiceClient:
|
||||
def __init__(self):
|
||||
self.listened_sink = None
|
||||
|
||||
def is_listening(self):
|
||||
return False
|
||||
|
||||
def listen(self, sink, after):
|
||||
self.listened_sink = sink
|
||||
created["after"] = after
|
||||
|
||||
monkeypatch.setattr(voice.voice_recv, "WaveSink", FakeWaveSink)
|
||||
monkeypatch.setattr(voice.voice_recv, "SilenceGeneratorSink", FakeSilenceGeneratorSink)
|
||||
|
||||
vc = FakeVoiceClient()
|
||||
output_path = tmp_path / "meeting.wav"
|
||||
recorder = voice.MeetingRecorder(vc, str(output_path))
|
||||
|
||||
asyncio.run(recorder.start(lambda error: None))
|
||||
|
||||
assert created["wave"].output_path == str(output_path)
|
||||
assert created["silence"].destination is created["wave"]
|
||||
assert vc.listened_sink is created["silence"]
|
||||
assert recorder.recording is True
|
||||
|
||||
Reference in New Issue
Block a user