Skip to content

Commit

Permalink
commenting monthlyContributorsErrorTest and adding TODO plus code sty…
Browse files Browse the repository at this point in the history
…le fix
  • Loading branch information
VitorVieiraZ committed Nov 26, 2024
1 parent 3f41a61 commit b34dae3
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion mergin/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ def teardown():
# back to original values... (1 project, api allowed ...)
client.patch(
f"/v1/tests/workspaces/{client_workspace_id}",
{"limits_override": {"storage": client_workspace_storage, "projects": 1, "api_allowed": True}},
{
"limits_override": {
"storage": client_workspace_storage,
"projects": 1,
"monthly_contributors": 1000,
"api_allowed": True,
}
},
{"Content-Type": "application/json"},
)

Expand Down Expand Up @@ -2711,3 +2718,35 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
assert e.value.http_error == 422
assert e.value.http_method == "POST"
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"


# TODO: refactor tests to create workspaces on each run and apply test_error_monthly_contributors_limit_hit
# def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
# test_project = "test_monthly_contributors_limit_hit"
# test_project_fullname = STORAGE_WORKSPACE + "/" + test_project

# client_workspace = None
# for workspace in mcStorage.workspaces_list():
# if workspace["name"] == STORAGE_WORKSPACE:
# client_workspace = workspace
# break

# client_workspace_id = client_workspace["id"]
# mcStorage.patch(
# f"/v1/tests/workspaces/{client_workspace_id}",
# {"limits_override": {"monthly_contributors": 0, "api_allowed": True}},
# {"Content-Type": "application/json"},
# )

# with pytest.raises(ClientError) as e:
# mcStorage.create_project_and_push(test_project_fullname, project_dir)

# assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value
# assert e.value.detail == (
# "Maximum number of workspace contributors is reached. "
# "Please upgrade your subscription to push changes or create projects."
# )
# assert e.value.http_error == 422
# assert e.value.http_method == "POST"
# assert e.value.url == f"{mc.url}v1/project/testpluginstorage"
# assert e.value.contributors_quota == 0

0 comments on commit b34dae3

Please sign in to comment.