Skip to content

Commit e9144ed

Browse files
committed
upd(web): added test covering UTF-8 for _get_file_with_content
1 parent cca390f commit e9144ed

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/web/test_main.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ def test_write_file(client: TestClient, project_tmp_path: Path) -> None:
106106
}
107107

108108

109+
def test_write_file_non_ascii(client: TestClient, project_tmp_path: Path) -> None:
110+
response = client.post("/api/files/foo.txt", json={"content": "何か良いこと"})
111+
file = _get_file_with_content(project_tmp_path / "foo.txt", "foo.txt")
112+
assert response.status_code == 204
113+
assert file.dict() == {
114+
"name": "foo.txt",
115+
"path": "foo.txt",
116+
"extension": ".txt",
117+
"content": "何か良いこと",
118+
}
119+
120+
121+
109122
def test_update_file(client: TestClient, project_tmp_path: Path) -> None:
110123
txt_file = project_tmp_path / "foo.txt"
111124
txt_file.write_text("bar")

0 commit comments

Comments
 (0)