@@ -69,6 +69,41 @@ def test_export_project_route(client: FlaskClient, tmp_path: Path) -> None:
6969 database_root_path = os .path .join (project_folder , "project.db" )
7070 with open (database_root_path , "wb" ) as f :
7171 f .write (b"test_project_db" )
72+
73+ with get_session () as session :
74+ session .query (Data ).delete ()
75+ session .commit ()
76+
77+ data1 = Data (
78+ id = "test_data_1" ,
79+ geode_object = "BRep" ,
80+ viewer_object = "BRep" ,
81+ input_file = "test_native.txt" ,
82+ native_file = "test_native.txt" ,
83+ additional_files = [],
84+ )
85+ data2 = Data (
86+ id = "test_data_2" ,
87+ geode_object = "Section" ,
88+ viewer_object = "Section" ,
89+ input_file = "test_input.txt" ,
90+ native_file = "test_native2.txt" ,
91+ additional_files = [],
92+ )
93+ session .add (data1 )
94+ session .add (data2 )
95+ session .commit ()
96+
97+ data1_dir = os .path .join (project_folder , "test_data_1" )
98+ os .makedirs (data1_dir , exist_ok = True )
99+ with open (os .path .join (data1_dir , "test_native.txt" ), "w" ) as f :
100+ f .write ("native file content" )
101+
102+ data2_dir = os .path .join (project_folder , "test_data_2" )
103+ os .makedirs (data2_dir , exist_ok = True )
104+ with open (os .path .join (data2_dir , "test_input.txt" ), "w" ) as f :
105+ f .write ("input file content" )
106+
72107 response = client .post (route , json = {"snapshot" : snapshot , "filename" : filename })
73108 assert response .status_code == 200
74109 assert response .headers .get ("new-file-name" ) == filename
@@ -77,13 +112,18 @@ def test_export_project_route(client: FlaskClient, tmp_path: Path) -> None:
77112 zip_bytes = response .get_data ()
78113 tmp_zip_path = tmp_path / filename
79114 tmp_zip_path .write_bytes (zip_bytes )
115+
80116 with zipfile .ZipFile (tmp_zip_path , "r" ) as zip_file :
81117 names = zip_file .namelist ()
82118 assert "snapshot.json" in names
83119 parsed = json .loads (zip_file .read ("snapshot.json" ).decode ("utf-8" ))
84120 assert parsed == snapshot
85121 assert "project.db" in names
122+ assert "test_data_1/test_native.txt" in names
123+ assert "test_data_2/test_input.txt" in names
124+
86125 response .close ()
126+
87127 export_path = os .path .join (project_folder , filename )
88128 if os .path .exists (export_path ):
89129 os .remove (export_path )
0 commit comments