Skip to content

Commit ae0341e

Browse files
authored
Merge pull request #226 from MerginMaps/revert-monthly-contributor
Partial reverse of 74222e4 to remove the monthly contributor error dialog
2 parents 0413f86 + ea7ef0e commit ae0341e

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

mergin/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
class ErrorCode(Enum):
1515
ProjectsLimitHit = "ProjectsLimitHit"
1616
StorageLimitHit = "StorageLimitHit"
17-
MonthlyContributorsLimitHit = "MonthlyContributorsLimitHit"
1817

1918

2019
class ClientError(Exception):

mergin/test/test_client.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454

5555
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}
5757

5858

5959
@pytest.fixture(scope="function")
@@ -2719,43 +2719,6 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
27192719
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
27202720

27212721

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
2757-
2758-
27592722
def test_workspace_requests(mc2: MerginClient):
27602723
test_project = "test_permissions"
27612724
test_project_fullname = API_USER2 + "/" + test_project

0 commit comments

Comments
 (0)