Skip to content

Commit c76a302

Browse files
nanae772Hiroshiba
andauthored
test: validate_kana APIのスナップショットテスト (#1531)
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
1 parent bc887f3 commit c76a302

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

test/e2e/single_api/tts_pipeline/__snapshots__/test_validate_kana/test_post_validate_kana_200.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/single_api/tts_pipeline/__snapshots__/test_validate_kana/test_post_validate_kana_400.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/single_api/tts_pipeline/__snapshots__/test_validate_kana/test_post_validate_kana_422.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
/validate_kana API のテスト
3+
"""
4+
5+
from fastapi.testclient import TestClient
6+
from syrupy.assertion import SnapshotAssertion
7+
8+
9+
def test_post_validate_kana_200(
10+
client: TestClient, snapshot_json: SnapshotAssertion
11+
) -> None:
12+
response = client.post("/validate_kana", params={"text": "コンニチワ'"})
13+
assert response.status_code == 200
14+
assert snapshot_json == response.json()
15+
16+
17+
def test_post_validate_kana_400(
18+
client: TestClient, snapshot_json: SnapshotAssertion
19+
) -> None:
20+
# text が AquesTalk 風記法に従わない場合はエラー
21+
response = client.post("/validate_kana", params={"text": "こんにちは"})
22+
assert response.status_code == 400
23+
assert snapshot_json == response.json()
24+
25+
26+
def test_post_validate_kana_422(
27+
client: TestClient, snapshot_json: SnapshotAssertion
28+
) -> None:
29+
# query パラメータに text が無い場合はエラー
30+
response = client.post("/validate_kana")
31+
assert response.status_code == 422
32+
assert snapshot_json == response.json()

0 commit comments

Comments
 (0)