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