1919 decode_token_data ,
2020 TokenError ,
2121 ServerType ,
22+ ErrorCode
2223)
2324from ..client_push import push_project_async , push_project_cancel
2425from ..client_pull import (
@@ -2629,3 +2630,35 @@ def test_editor_push(mc: MerginClient, mc2: MerginClient):
26292630 conflicted_file = project_file
26302631 # There is no conflicted qgs file
26312632 assert conflicted_file is None
2633+
2634+
2635+ def test_error_push_already_named_project (mc : MerginClient ):
2636+ test_project = "test_push_already_existing"
2637+ project = API_USER + "/" + test_project
2638+ project_dir = os .path .join (TMP_DIR , test_project )
2639+
2640+ try :
2641+ mc .create_project_and_push (test_project , project_dir )
2642+ except ClientError as e :
2643+ print (e )
2644+ assert e .detail == 'Project with the same name already exists'
2645+ assert e .http_error == 409
2646+ assert e .http_method == 'POST'
2647+ assert e .url == 'https://test.dev.merginmaps.com/v1/project/test_plugin'
2648+
2649+ def test_error_projects_limit_hit (mcStorage : MerginClient ):
2650+ test_project = "test_another_project_above_projects_limit"
2651+ test_project_fullname = STORAGE_WORKSPACE + "/" + test_project
2652+
2653+ project_dir = os .path .join (TMP_DIR , test_project , API_USER )
2654+
2655+ try :
2656+ mcStorage .create_project_and_push (test_project , project_dir )
2657+ except ClientError as e :
2658+ print ("BLVAVBLA" )
2659+ print (e )
2660+ assert e .server_code == ErrorCode .ProjectsLimitHit .value
2661+ assert e .detail == 'Project with the same name already exists'
2662+ assert e .http_error == 422
2663+ assert e .http_method == 'POST'
2664+ assert e .url == 'https://test.dev.merginmaps.com/v1/project/test_plugin'
0 commit comments