Skip to content

Commit 3c2704b

Browse files
committed
attempt to fix tests
1 parent 4387b41 commit 3c2704b

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

mergin/test/test_client.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ def mcStorage(request):
7878
break
7979
client_workspace_id = client_workspace["id"]
8080
client_workspace_storage = client_workspace["storage"]
81-
81+
8282
def teardown():
8383
# back to original values... (1 project, api allowed ...)
8484
client.patch(
8585
f"/v1/tests/workspaces/{client_workspace_id}",
86-
{"limits_override": {"storage": client_workspace_storage, "projects": 1, "api_allowed": True}},
86+
{"limits_override": {"storage": client_workspace_storage, "projects": 1, "monthly_contributors": 500, "api_allowed": True}},
8787
{"Content-Type": "application/json"},
8888
)
8989

@@ -2714,19 +2714,27 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
27142714

27152715

27162716
def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
2717-
test_project = "test_another_project_above_monthly_contributors_limit_hit"
2717+
test_project = "test_monthly_contributors_limit"
27182718
test_project_fullname = STORAGE_WORKSPACE + "/" + test_project
27192719

27202720
client_workspace = None
27212721
for workspace in mcStorage.workspaces_list():
27222722
if workspace["name"] == STORAGE_WORKSPACE:
27232723
client_workspace = workspace
27242724
break
2725-
27262725
client_workspace_id = client_workspace["id"]
2726+
client_workspace_storage = client_workspace["storage"]
2727+
27272728
mcStorage.patch(
27282729
f"/v1/tests/workspaces/{client_workspace_id}",
2729-
{"limits_override": {"monthly_contributors": 0, "api_allowed": True}},
2730+
{
2731+
"limits_override": {
2732+
"storage": client_workspace_storage,
2733+
"projects": 50,
2734+
"monthly_contributors": 0,
2735+
"api_allowed": True
2736+
}
2737+
},
27302738
{"Content-Type": "application/json"},
27312739
)
27322740

@@ -2737,10 +2745,9 @@ def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
27372745

27382746
assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value
27392747
assert e.value.detail == (
2740-
"Maximum number of workspace contributors is reached. "
2741-
"Please upgrade your subscription to push changes or create projects."
2748+
"Maximum number of workspace contributors is reached. Please upgrade your subscription to push changes or create projects. (MonthlyContributorsLimitHit)"
27422749
)
27432750
assert e.value.http_error == 422
27442751
assert e.value.http_method == "POST"
2745-
assert e.value.url == f"{mc.url}v1/project/{API_USER}"
27462752
assert e.value.contributors_quota == 0
2753+
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"

0 commit comments

Comments
 (0)