@@ -400,7 +400,6 @@ def test_add_project(client, app, data, expected):
400400 )
401401 upload_chunks (upload_dir , upload .changes )
402402 resp = client .post ("/v1/project/push/finish/{}" .format (upload .id ))
403- print (resp .json )
404403 assert resp .status_code == 200
405404
406405 # add TEMPLATES user and make him creator of test_project (to become template)
@@ -434,6 +433,7 @@ def test_add_project(client, app, data, expected):
434433 )
435434 pv = project .get_latest_version ()
436435 assert pv .user_agent is not None
436+ assert pv .device_id == json_headers ["X-Device-Id" ]
437437 # check if there is no diffs in cloned files
438438 assert not any ("diff" in file for file in project .files )
439439 assert not any ("diff" in file for file in pv .files )
@@ -459,6 +459,7 @@ def test_versioning(client):
459459 pv = project .get_latest_version ()
460460 assert pv .name == "v0"
461461 assert pv .project_size == 0
462+ assert pv .device_id == json_headers ["X-Device-Id" ]
462463
463464
464465def test_delete_project (client ):
@@ -1367,7 +1368,7 @@ def test_push_finish(client):
13671368 upload , upload_dir = create_transaction ("mergin" , changes )
13681369 url = "/v1/project/push/finish/{}" .format (upload .id )
13691370
1370- resp = client .post (url )
1371+ resp = client .post (url , headers = json_headers )
13711372 assert resp .status_code == 422
13721373 assert "corrupted_files" in resp .json ["detail" ].keys ()
13731374 assert not os .path .exists (os .path .join (upload_dir , "files" , "test.txt" ))
@@ -1384,11 +1385,12 @@ def test_push_finish(client):
13841385 with open (os .path .join (upload_dir , "chunks" , chunk ), "wb" ) as out_file :
13851386 out_file .write (in_file .read (CHUNK_SIZE ))
13861387
1387- resp2 = client .post (url )
1388+ resp2 = client .post (url , headers = { ** json_headers , "User-Agent" : "Werkzeug" } )
13881389 assert resp2 .status_code == 200
13891390 assert not os .path .exists (upload_dir )
13901391 version = upload .project .get_latest_version ()
13911392 assert version .user_agent
1393+ assert version .device_id == json_headers ["X-Device-Id" ]
13921394 # chunks is only temporal information, it should not be in db
13931395 assert "chunks" not in version .changes ["added" ][0 ].keys ()
13941396 assert "chunks" not in version .changes ["updated" ][0 ].keys ()
@@ -1699,6 +1701,7 @@ def test_clone_project(client, data, username, expected):
16991701 assert not any ("diff" in file for file in pv .files )
17001702 assert pv .changes .get ("removed" ) == []
17011703 assert pv .changes .get ("updated" ) == []
1704+ assert pv .device_id == json_headers ["X-Device-Id" ]
17021705 assert "diff" not in pv .changes .get ("added" )
17031706 # cleanup
17041707 shutil .rmtree (project .storage .project_dir )
0 commit comments