@@ -212,7 +212,9 @@ def test_file_diff_download(client, diff_project):
212212 file_path_id = gpkg_file .id , version = 4 , rank = 0
213213 ).first ()
214214
215- response = client .get (f"v2/projects/{ diff_project .id } /raw/diff/{ diff_file .path } " )
215+ response = client .get (
216+ f"v2/projects/{ diff_project .id } /raw/diff?file={ diff_file .path } "
217+ )
216218 assert response .status_code == 200
217219 assert response .content_type == "application/octet-stream"
218220
@@ -231,7 +233,7 @@ def test_file_diff_download(client, diff_project):
231233 assert not os .path .exists (diff .abs_path )
232234
233235 # download merged diff with its reconstuction on the fly
234- response = client .get (f"v2/projects/{ diff_project .id } /raw/diff/ { diff .path } " )
236+ response = client .get (f"v2/projects/{ diff_project .id } /raw/diff?file= { diff .path } " )
235237 assert response .status_code == 200
236238 assert response .content_type == "application/octet-stream"
237239 assert os .path .exists (diff .abs_path )
@@ -240,13 +242,39 @@ def test_file_diff_download(client, diff_project):
240242 with patch .object (FileDiff , "construct_checkpoint" ) as construct_checkpoint_mock :
241243 os .remove (diff .abs_path )
242244 construct_checkpoint_mock .return_value = False
243- response = client .get (f"v2/projects/{ diff_project .id } /raw/diff/{ diff .path } " )
245+ response = client .get (
246+ f"v2/projects/{ diff_project .id } /raw/diff?file={ diff .path } "
247+ )
244248 assert response .status_code == 422
245249 assert response .json ["code" ] == DiffDownloadError .code
246250
247- response = client .get (f"v2/projects/{ diff_project .id } /raw/diff/ { diff .path } +1" )
251+ response = client .get (f"v2/projects/{ diff_project .id } /raw/diff?file= { diff .path } +1" )
248252 assert response .status_code == 404
249253
254+ subfolder_test_gpkg = os .path .join (
255+ diff_project .storage .project_dir , "test_dir" , "test.gpkg"
256+ )
257+ os .makedirs (os .path .dirname (subfolder_test_gpkg ), exist_ok = True )
258+ shutil .copy (
259+ os .path .join (test_project_dir , "base.gpkg" ),
260+ subfolder_test_gpkg ,
261+ )
262+ # shutil.copy(
263+ # test_gpkg_file,
264+ # os.path.join(diff_project.storage.project_dir, "v9", "test_dir", "test.gpkg"),
265+ # )
266+ push_change (
267+ diff_project , "added" , "test_dir/test.gpkg" , diff_project .storage .project_dir
268+ )
269+ sql = f"UPDATE simple SET rating={ 1000 } "
270+ execute_query (subfolder_test_gpkg , sql )
271+ pv = push_change (
272+ diff_project , "updated" , "test_dir/test.gpkg" , diff_project .storage .project_dir
273+ )
274+ fd = FileDiff .query .filter_by (version = pv .name , rank = 0 ).first ()
275+ response = client .get (f"v2/projects/{ diff_project .id } /raw/diff?file={ fd .path } " )
276+ assert response .status_code == 200
277+
250278
251279def test_create_diff_checkpoint (diff_project ):
252280 """Test creation of diff checkpoints"""
@@ -738,7 +766,7 @@ def test_project_version_delta_changes(client, diff_project: Project):
738766
739767 # check if checkpoint will be there
740768 response = client .get (
741- f"v2/projects/{ diff_project .id } /raw/diff/ { delta [0 ].diffs [0 ].id } "
769+ f"v2/projects/{ diff_project .id } /raw/diff?file= { delta [0 ].diffs [0 ].id } "
742770 )
743771 assert response .status_code == 200
744772
@@ -1339,7 +1367,9 @@ def test_project_pull_diffs(client, diff_project):
13391367 second_diff = delta [0 ]["diffs" ][1 ]
13401368 assert first_diff ["id" ] == current_diffs [0 ].path
13411369 assert second_diff ["id" ] == current_diffs [1 ].path
1342- response = client .get (f"v2/projects/{ diff_project .id } /raw/diff/{ first_diff ['id' ]} " )
1370+ response = client .get (
1371+ f"v2/projects/{ diff_project .id } /raw/diff?file={ first_diff ['id' ]} "
1372+ )
13431373 assert response .status_code == 200
13441374
13451375
0 commit comments