31 lines
888 B
Python
31 lines
888 B
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
|
|
from cthulhu import speech
|
|
|
|
|
|
class PresentationInterruptSoundRegressionTests(unittest.TestCase):
|
|
def test_speech_stop_also_stops_sound_playback(self):
|
|
speechServer = mock.Mock()
|
|
echoServer = mock.Mock()
|
|
soundPlayer = mock.Mock()
|
|
|
|
with (
|
|
mock.patch.object(speech, "_speechserver", speechServer),
|
|
mock.patch.object(speech, "_echoSpeechserver", echoServer),
|
|
mock.patch.object(speech.sound, "getPlayer", return_value=soundPlayer),
|
|
):
|
|
speech.stop()
|
|
|
|
speechServer.stop.assert_called_once_with()
|
|
echoServer.stop.assert_called_once_with()
|
|
soundPlayer.stop.assert_called_once_with()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|