Skip to content

Commit b34dae3

Browse files
committed
commenting monthlyContributorsErrorTest and adding TODO plus code style fix
1 parent 3f41a61 commit b34dae3

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

mergin/test/test_client.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ 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+
{
87+
"limits_override": {
88+
"storage": client_workspace_storage,
89+
"projects": 1,
90+
"monthly_contributors": 1000,
91+
"api_allowed": True,
92+
}
93+
},
8794
{"Content-Type": "application/json"},
8895
)
8996

@@ -2711,3 +2718,35 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
27112718
assert e.value.http_error == 422
27122719
assert e.value.http_method == "POST"
27132720
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
2721+
2722+
2723+
# TODO: refactor tests to create workspaces on each run and apply test_error_monthly_contributors_limit_hit
2724+
# def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
2725+
# test_project = "test_monthly_contributors_limit_hit"
2726+
# test_project_fullname = STORAGE_WORKSPACE + "/" + test_project
2727+
2728+
# client_workspace = None
2729+
# for workspace in mcStorage.workspaces_list():
2730+
# if workspace["name"] == STORAGE_WORKSPACE:
2731+
# client_workspace = workspace
2732+
# break
2733+
2734+
# client_workspace_id = client_workspace["id"]
2735+
# mcStorage.patch(
2736+
# f"/v1/tests/workspaces/{client_workspace_id}",
2737+
# {"limits_override": {"monthly_contributors": 0, "api_allowed": True}},
2738+
# {"Content-Type": "application/json"},
2739+
# )
2740+
2741+
# with pytest.raises(ClientError) as e:
2742+
# mcStorage.create_project_and_push(test_project_fullname, project_dir)
2743+
2744+
# assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value
2745+
# assert e.value.detail == (
2746+
# "Maximum number of workspace contributors is reached. "
2747+
# "Please upgrade your subscription to push changes or create projects."
2748+
# )
2749+
# assert e.value.http_error == 422
2750+
# assert e.value.http_method == "POST"
2751+
# assert e.value.url == f"{mc.url}v1/project/testpluginstorage"
2752+
# assert e.value.contributors_quota == 0

0 commit comments

Comments
 (0)