|
53 | 53 |
|
54 | 54 |
|
55 | 55 | def get_limit_overrides(storage: int): |
56 | | - return {"storage": storage, "projects": 2, "api_allowed": True, "monthly_contributors": -1} |
| 56 | + return {"storage": storage, "projects": 2, "api_allowed": True} |
57 | 57 |
|
58 | 58 |
|
59 | 59 | @pytest.fixture(scope="function") |
@@ -2717,40 +2717,3 @@ def test_error_projects_limit_hit(mcStorage: MerginClient): |
2717 | 2717 | assert e.value.http_error == 422 |
2718 | 2718 | assert e.value.http_method == "POST" |
2719 | 2719 | assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage" |
2720 | | - |
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 | | - project_dir = os.path.join(TMP_DIR, test_project) |
2726 | | - test_project_fullname = STORAGE_WORKSPACE + "/" + test_project |
2727 | | - cleanup(mcStorage, test_project_fullname, [project_dir]) |
2728 | | - |
2729 | | - client_workspace = None |
2730 | | - for workspace in mcStorage.workspaces_list(): |
2731 | | - if workspace["name"] == STORAGE_WORKSPACE: |
2732 | | - client_workspace = workspace |
2733 | | - break |
2734 | | - |
2735 | | - client_workspace_id = client_workspace["id"] |
2736 | | - client_workspace_storage = client_workspace["storage"] |
2737 | | - mcStorage.patch( |
2738 | | - f"/v1/tests/workspaces/{client_workspace_id}", |
2739 | | - {"limits_override": {**get_limit_overrides(client_workspace_storage), "monthly_contributors": 0}}, |
2740 | | - {"Content-Type": "application/json"}, |
2741 | | - ) |
2742 | | - |
2743 | | - mcStorage.create_project_and_push(test_project_fullname, project_dir) |
2744 | | - shutil.copy(os.path.join(TEST_DATA_DIR, "test.txt"), project_dir) |
2745 | | - with pytest.raises(ClientError) as e: |
2746 | | - mcStorage.push_project(project_dir) |
2747 | | - |
2748 | | - assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value |
2749 | | - assert e.value.detail == ( |
2750 | | - "Maximum number of workspace contributors is reached. " |
2751 | | - "Please upgrade your subscription to push changes or create projects. (MonthlyContributorsLimitHit)" |
2752 | | - ) |
2753 | | - assert e.value.http_error == 422 |
2754 | | - assert e.value.http_method == "POST" |
2755 | | - assert e.value.url == f"{mcStorage.url}v1/project/push/testpluginstorage/{test_project}" |
2756 | | - assert e.value.server_response.get("contributors_quota") == 0 |
0 commit comments