Refactor Phase 2: Split stories.py into Schema/Service/Controller, add missing endpoints, fix async bug
This commit is contained in:
@@ -121,7 +121,7 @@ def mock_text_provider():
|
||||
cover_prompt_suggestion="A cute rabbit",
|
||||
)
|
||||
|
||||
with patch("app.api.stories.generate_story_content", new_callable=AsyncMock) as mock:
|
||||
with patch("app.services.story_service.generate_story_content", new_callable=AsyncMock) as mock:
|
||||
mock.return_value = mock_result
|
||||
yield mock
|
||||
|
||||
@@ -129,7 +129,7 @@ def mock_text_provider():
|
||||
@pytest.fixture
|
||||
def mock_image_provider():
|
||||
"""Mock 图像生成。"""
|
||||
with patch("app.api.stories.generate_image", new_callable=AsyncMock) as mock:
|
||||
with patch("app.services.story_service.generate_image", new_callable=AsyncMock) as mock:
|
||||
mock.return_value = "https://example.com/image.png"
|
||||
yield mock
|
||||
|
||||
@@ -137,7 +137,7 @@ def mock_image_provider():
|
||||
@pytest.fixture
|
||||
def mock_tts_provider():
|
||||
"""Mock TTS。"""
|
||||
with patch("app.api.stories.text_to_speech", new_callable=AsyncMock) as mock:
|
||||
with patch("app.services.provider_router.text_to_speech", new_callable=AsyncMock) as mock:
|
||||
mock.return_value = b"fake-audio-bytes"
|
||||
yield mock
|
||||
|
||||
|
||||
Reference in New Issue
Block a user