@@ -106,6 +106,18 @@ 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+
109121def test_update_file (client : TestClient , project_tmp_path : Path ) -> None :
110122 txt_file = project_tmp_path / "foo.txt"
111123 txt_file .write_text ("bar" )
@@ -212,7 +224,12 @@ def test_create_directory(client: TestClient, project_tmp_path: Path) -> None:
212224 response = client .post ("/api/directories/new_dir" )
213225 assert response .status_code == 200
214226 assert (project_tmp_path / "new_dir" ).exists ()
215- assert response .json () == {"directories" : [], "files" : [], "name" : "new_dir" , "path" : "new_dir" }
227+ assert response .json () == {
228+ "directories" : [],
229+ "files" : [],
230+ "name" : "new_dir" ,
231+ "path" : "new_dir" ,
232+ }
216233
217234
218235def test_create_directory_already_exists (client : TestClient , project_tmp_path : Path ) -> None :
@@ -494,7 +511,9 @@ def test_delete_environment_failure(
494511 client : TestClient , web_sushi_context : Context , mocker : MockerFixture
495512):
496513 mocker .patch .object (
497- web_sushi_context .state_sync , "invalidate_environment" , side_effect = Exception ("Some error" )
514+ web_sushi_context .state_sync ,
515+ "invalidate_environment" ,
516+ side_effect = Exception ("Some error" ),
498517 )
499518
500519 response = client .delete ("/api/environments/test" )
0 commit comments