Skip to content

Commit 7f25f97

Browse files
committed
fixing tests def
1 parent 4878d95 commit 7f25f97

File tree

2 files changed

+18
-46
lines changed

2 files changed

+18
-46
lines changed

.github/workflows/autotests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
2929
- name: Run tests
3030
run: |
31-
pytest --cov=mergin mergin/test/
31+
pytest --cov=mergin mergin/test/test_client.py -k test_dummy_mcStorage
3232
3333
- name: Submit coverage to Coveralls
3434
env:

mergin/test/test_client.py

Lines changed: 17 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,66 +2718,38 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
27182718
assert e.value.http_error == 422
27192719
assert e.value.http_method == "POST"
27202720
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
2721-
2722-
2723-
def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
2724-
test_project = "test_monthly_contributors_limit"
2725-
test_project_fullname = STORAGE_WORKSPACE + "/" + test_project
2726-
2721+
2722+
def test_dummy_mcStorage(mcStorage: MerginClient, mc: MerginClient):
27272723
client_workspace = None
27282724
for workspace in mcStorage.workspaces_list():
27292725
if workspace["name"] == STORAGE_WORKSPACE:
27302726
client_workspace = workspace
27312727
break
27322728
client_workspace_id = client_workspace["id"]
27332729
client_workspace_storage = client_workspace["storage"]
2734-
2730+
27352731
mcStorage.patch(
27362732
f"/v1/tests/workspaces/{client_workspace_id}",
27372733
{
27382734
"limits_override": {
27392735
"storage": client_workspace_storage,
2740-
"projects": 50,
2741-
"monthly_contributors": 0,
2736+
"projects": 100,
2737+
"monthly_contributors": 1000,
27422738
"api_allowed": True,
27432739
}
27442740
},
27452741
{"Content-Type": "application/json"},
27462742
)
2747-
2748-
project_dir = os.path.join(TMP_DIR, test_project, API_USER)
2749-
2750-
with pytest.raises(ClientError) as e:
2751-
mcStorage.create_project_and_push(test_project_fullname, project_dir)
2752-
2753-
assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value
2754-
assert e.value.detail == (
2755-
"Maximum number of workspace contributors is reached. Please upgrade your subscription to push changes or create projects. (MonthlyContributorsLimitHit)"
2756-
)
2757-
assert e.value.http_error == 422
2758-
assert e.value.http_method == "POST"
2759-
assert e.value.contributors_quota == 0
2760-
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
2761-
2762-
2763-
# def test_dummy_mcStorage(mcStorage: MerginClient):
2764-
# client_workspace = None
2765-
# for workspace in mcStorage.workspaces_list():
2766-
# if workspace["name"] == STORAGE_WORKSPACE:
2767-
# client_workspace = workspace
2768-
# break
2769-
# client_workspace_id = client_workspace["id"]
2770-
# client_workspace_storage = client_workspace["storage"]
27712743

2772-
# mcStorage.patch(
2773-
# f"/v1/tests/workspaces/{client_workspace_id}",
2774-
# {
2775-
# "limits_override": {
2776-
# "storage": client_workspace_storage,
2777-
# "projects": 50,
2778-
# "monthly_contributors": 1000,
2779-
# "api_allowed": True,
2780-
# }
2781-
# },
2782-
# {"Content-Type": "application/json"},
2783-
# )
2744+
mc.patch(
2745+
f"/v1/tests/workspaces/{client_workspace_id}",
2746+
{
2747+
"limits_override": {
2748+
"storage": client_workspace_storage,
2749+
"projects": 100,
2750+
"monthly_contributors": 1000,
2751+
"api_allowed": True,
2752+
}
2753+
},
2754+
{"Content-Type": "application/json"},
2755+
)

0 commit comments

Comments
 (0)