Files
wehub-resource-sync fed8b2eed7
Build and push multi-arch DocsGPT Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Has been cancelled
Backend release / release (push) Has been cancelled
Bandit Security Scan / bandit_scan (push) Has been cancelled
Build and push multi-arch DocsGPT Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Has been cancelled
Build and push multi-arch DocsGPT Docker image / manifest (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / build (linux/amd64, ubuntu-latest, amd64) (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Has been cancelled
Build and push DocsGPT FE Docker image for development / manifest (push) Has been cancelled
Python linting / ruff (push) Has been cancelled
Run python tests with pytest / Run tests and count coverage (3.12) (push) Has been cancelled
React Widget Build / build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:28:29 +08:00

25 lines
691 B
Python

import base64
from application.tts.google_tts import GoogleTTS
def test_google_tts_text_to_speech(monkeypatch):
captured = {}
class DummyGTTS:
def __init__(self, *, text, lang, slow):
captured["args"] = {"text": text, "lang": lang, "slow": slow}
def write_to_fp(self, fp):
fp.write(b"synthetic-audio")
monkeypatch.setattr("application.tts.google_tts.gTTS", DummyGTTS)
tts = GoogleTTS()
audio_base64, lang = tts.text_to_speech("hello world")
assert captured["args"] == {"text": "hello world", "lang": "en", "slow": False}
assert lang == "en"
assert base64.b64decode(audio_base64.encode()) == b"synthetic-audio"