@@ -207,7 +207,7 @@ def test_lost_file(self):
207
207
self .assertEqual (audio_file1 , audio_file2 )
208
208
self .assertTrue (os .path .exists (audio_file2 ))
209
209
210
- def test_no_connection (self ):
210
+ def test_no_connection_novel (self ):
211
211
from tts .db import DB
212
212
from tts .synthesizer import SpeechSynthesizer
213
213
from tts .srv import SynthesizerRequest
@@ -224,6 +224,31 @@ def test_no_connection(self):
224
224
225
225
self .assertEqual (db .get_num_files (), init_num_files )
226
226
227
+ def test_no_connection_existing (self ):
228
+ from tts .db import DB
229
+ from tts .synthesizer import SpeechSynthesizer
230
+ from tts .srv import SynthesizerRequest
231
+ import uuid
232
+ import json
233
+
234
+ target_text = uuid .uuid4 ().hex
235
+
236
+ speech_synthesizer = SpeechSynthesizer (engine = 'DUMMY' )
237
+ request = SynthesizerRequest (text = target_text , metadata = {})
238
+ response = speech_synthesizer ._node_request_handler (request )
239
+ res_dict = json .loads (response .result )
240
+ audio_file1 = res_dict ['Audio File' ]
241
+
242
+ speech_synthesizer .engine .set_connection (False )
243
+
244
+ speech_synthesizer = SpeechSynthesizer (engine = 'DUMMY' )
245
+ request = SynthesizerRequest (text = target_text , metadata = {})
246
+ response = speech_synthesizer ._node_request_handler (request )
247
+ res_dict = json .loads (response .result )
248
+ audio_file2 = res_dict ['Audio File' ]
249
+
250
+ self .assertEqual (audio_file1 , audio_file2 )
251
+
227
252
def test_file_cleanup (self ):
228
253
from tts .db import DB
229
254
from tts .synthesizer import SpeechSynthesizer
0 commit comments