Skip to content

Commit d62273d

Browse files
committed
test attempt
1 parent a79c081 commit d62273d

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

mergin/test/test_client.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,32 +2713,41 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
27132713
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
27142714

27152715

2716-
def test_error_monthly_contributors_limit_hit(mc: MerginClient):
2717-
test_project = "test_project_monthly_contributors_limit_hit"
2718-
test_project_fullname = API_USER + "/" + test_project
2716+
def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
2717+
test_project = "test_monthly_contributors_limit"
2718+
test_project_fullname = STORAGE_WORKSPACE + "/" + test_project
27192719

27202720
client_workspace = None
2721-
for workspace in mc.workspaces_list():
2722-
if workspace["name"] == API_USER:
2721+
for workspace in mcStorage.workspaces_list():
2722+
if workspace["name"] == STORAGE_WORKSPACE:
27232723
client_workspace = workspace
27242724
break
2725-
27262725
client_workspace_id = client_workspace["id"]
2727-
mc.patch(
2726+
client_workspace_storage = client_workspace["storage"]
2727+
2728+
mcStorage.patch(
27282729
f"/v1/tests/workspaces/{client_workspace_id}",
2729-
{"limits_override": {"monthly_contributors": 0}},
2730+
{
2731+
"limits_override": {
2732+
"storage": client_workspace_storage,
2733+
"monthly_contributors": 0,
2734+
"api_allowed": True
2735+
}
2736+
},
27302737
{"Content-Type": "application/json"},
27312738
)
27322739

2733-
with pytest.raises(ClientError) as e:
2734-
mc.create_project(test_project_fullname)
2740+
project_dir = os.path.join(TMP_DIR, test_project, API_USER)
27352741

2742+
with pytest.raises(ClientError) as e:
2743+
mcStorage.create_project_and_push(test_project_fullname, project_dir)
2744+
27362745
assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value
27372746
assert e.value.detail == (
27382747
"Maximum number of workspace contributors is reached. "
27392748
"Please upgrade your subscription to push changes or create projects."
27402749
)
27412750
assert e.value.http_error == 422
27422751
assert e.value.http_method == "POST"
2743-
assert e.value.url == f"{mcStorage.url}v1/project/{API_USER}"
27442752
assert e.value.contributors_quota == 0
2753+
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"

0 commit comments

Comments
 (0)