@@ -83,7 +83,14 @@ def teardown():
83
83
# back to original values... (1 project, api allowed ...)
84
84
client .patch (
85
85
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
+ },
87
94
{"Content-Type" : "application/json" },
88
95
)
89
96
@@ -2711,3 +2718,35 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
2711
2718
assert e .value .http_error == 422
2712
2719
assert e .value .http_method == "POST"
2713
2720
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