Skip to content

Commit c4e9dbe

Browse files
committed
Adress PR comment on tests
1 parent 3350998 commit c4e9dbe

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

mergin/test/test_client.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,14 +2637,12 @@ def test_error_push_already_named_project(mc: MerginClient):
26372637
project = API_USER + "/" + test_project
26382638
project_dir = os.path.join(TMP_DIR, test_project)
26392639

2640-
try:
2640+
with pytest.raises(ClientError) as e:
26412641
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"
2642+
assert e.detail == "Project with the same name already exists"
2643+
assert e.http_error == 409
2644+
assert e.http_method == "POST"
2645+
assert e.url == f"{mc.url}v1/project/test_plugin"
26482646

26492647

26502648
def test_error_projects_limit_hit(mcStorage: MerginClient):
@@ -2653,14 +2651,13 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
26532651

26542652
project_dir = os.path.join(TMP_DIR, test_project, API_USER)
26552653

2656-
try:
2654+
with pytest.raises(ClientError) as e:
26572655
mcStorage.create_project_and_push(test_project_fullname, project_dir)
2658-
except ClientError as e:
2659-
assert e.server_code == ErrorCode.ProjectsLimitHit.value
2660-
assert (
2661-
e.detail
2662-
== "Maximum number of projects is reached. Please upgrade your subscription to create new projects (ProjectsLimitHit)"
2663-
)
2664-
assert e.http_error == 422
2665-
assert e.http_method == "POST"
2666-
assert e.url == "https://test.dev.merginmaps.com/v1/project/testpluginstorage"
2656+
assert e.server_code == ErrorCode.ProjectsLimitHit.value
2657+
assert (
2658+
e.detail
2659+
== "Maximum number of projects is reached. Please upgrade your subscription to create new projects (ProjectsLimitHit)"
2660+
)
2661+
assert e.http_error == 422
2662+
assert e.http_method == "POST"
2663+
assert e.url == "https://test.dev.merginmaps.com/v1/project/testpluginstorage"

0 commit comments

Comments
 (0)