@@ -2713,32 +2713,41 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
2713
2713
assert e .value .url == f"{ mcStorage .url } v1/project/testpluginstorage"
2714
2714
2715
2715
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
2719
2719
2720
2720
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 :
2723
2723
client_workspace = workspace
2724
2724
break
2725
-
2726
2725
client_workspace_id = client_workspace ["id" ]
2727
- mc .patch (
2726
+ client_workspace_storage = client_workspace ["storage" ]
2727
+
2728
+ mcStorage .patch (
2728
2729
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
+ },
2730
2737
{"Content-Type" : "application/json" },
2731
2738
)
2732
2739
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 )
2735
2741
2742
+ with pytest .raises (ClientError ) as e :
2743
+ mcStorage .create_project_and_push (test_project_fullname , project_dir )
2744
+
2736
2745
assert e .value .server_code == ErrorCode .MonthlyContributorsLimitHit .value
2737
2746
assert e .value .detail == (
2738
2747
"Maximum number of workspace contributors is reached. "
2739
2748
"Please upgrade your subscription to push changes or create projects."
2740
2749
)
2741
2750
assert e .value .http_error == 422
2742
2751
assert e .value .http_method == "POST"
2743
- assert e .value .url == f"{ mcStorage .url } v1/project/{ API_USER } "
2744
2752
assert e .value .contributors_quota == 0
2753
+ assert e .value .url == f"{ mcStorage .url } v1/project/testpluginstorage"
0 commit comments