def test_voice_base64_data(self):
if not options.cache_dir: return
response = self.fetch("/tts?text=hello")
status = escape.json_decode(response.body)
self.assertEqual(response.code, 200)
self.assertTrue(status["success"])
self.assertGreater(len(status["data"]["file"]), 0)
# ??????????????????
self.assertEqual(status["data"]["voice"], options.voice)
voicedata = base64.b64decode(status["data"]["sound_base64"])
with open(os.path.join(options.cache_dir,
status["data"]["file"]), "rb") as f:
filedata = f.read()
self.assertEqual(filedata, voicedata)
# ????cache??
评论列表
文章目录