remove whisper_live from patch to mock websocket
This commit is contained in:
@@ -8,7 +8,7 @@ from whisper_live.client import TranscriptionClient, resample
|
||||
|
||||
|
||||
class TestClientWebSocketCommunication(unittest.TestCase):
|
||||
@patch('whisper_live.client.websocket.WebSocketApp')
|
||||
@patch('websocket.WebSocketApp')
|
||||
def test_websocket_communication(self, mock_websocket):
|
||||
mock_ws_instance = MagicMock()
|
||||
mock_websocket.return_value = mock_ws_instance
|
||||
@@ -23,7 +23,7 @@ class TestClientWebSocketCommunication(unittest.TestCase):
|
||||
|
||||
|
||||
class TestClientCallbacks(unittest.TestCase):
|
||||
@patch('whisper_live.client.websocket.WebSocketApp')
|
||||
@patch('websocket.WebSocketApp')
|
||||
def setUp(self, mock_websocket):
|
||||
self.mock_ws_app = mock_websocket.return_value
|
||||
self.mock_ws_app.send = MagicMock()
|
||||
@@ -97,7 +97,7 @@ class TestAudioResampling(unittest.TestCase):
|
||||
|
||||
|
||||
class TestSendingAudioPacket(unittest.TestCase):
|
||||
@patch('whisper_live.client.websocket.WebSocketApp')
|
||||
@patch('websocket.WebSocketApp')
|
||||
def setUp(self, mock_websocket):
|
||||
self.transcription_client = TranscriptionClient("localhost", "9090")
|
||||
self.client = self.transcription_client.client
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestServerConnection(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.server = TranscriptionServer()
|
||||
|
||||
@mock.patch('whisper_live.server.websockets.WebSocketCommonProtocol')
|
||||
@mock.patch('websockets.WebSocketCommonProtocol')
|
||||
def test_connection(self, mock_websocket):
|
||||
mock_websocket.recv.return_value = json.dumps({
|
||||
'uid': 'test_client',
|
||||
@@ -51,7 +51,7 @@ class TestServerConnection(unittest.TestCase):
|
||||
self.server.recv_audio(mock_websocket, "faster_whisper")
|
||||
|
||||
|
||||
@mock.patch('whisper_live.server.websockets.WebSocketCommonProtocol')
|
||||
@mock.patch('websockets.WebSocketCommonProtocol')
|
||||
def test_recv_audio_exception_handling(self, mock_websocket):
|
||||
mock_websocket.recv.side_effect = [json.dumps({
|
||||
'uid': 'test_client',
|
||||
|
||||
Reference in New Issue
Block a user