Skip to content

Commit bdd6612

Browse files
committed
fixing future tests
1 parent 3c2704b commit bdd6612

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
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/ -k "test_error_monthly_contributors_limit_hit or dummy_mcStorage"
3232
3333
- name: Submit coverage to Coveralls
3434
env:

mergin/test/test_client.py

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,19 @@ def mcStorage(request):
7878
break
7979
client_workspace_id = client_workspace["id"]
8080
client_workspace_storage = client_workspace["storage"]
81-
81+
8282
def teardown():
8383
# back to original values... (1 project, api allowed ...)
8484
client.patch(
8585
f"/v1/tests/workspaces/{client_workspace_id}",
86-
{"limits_override": {"storage": client_workspace_storage, "projects": 1, "monthly_contributors": 500, "api_allowed": True}},
86+
{
87+
"limits_override": {
88+
"storage": client_workspace_storage,
89+
"projects": 1,
90+
"monthly_contributors": 500,
91+
"api_allowed": True,
92+
}
93+
},
8794
{"Content-Type": "application/json"},
8895
)
8996

@@ -2732,7 +2739,7 @@ def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
27322739
"storage": client_workspace_storage,
27332740
"projects": 50,
27342741
"monthly_contributors": 0,
2735-
"api_allowed": True
2742+
"api_allowed": True,
27362743
}
27372744
},
27382745
{"Content-Type": "application/json"},
@@ -2745,9 +2752,37 @@ def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
27452752

27462753
assert e.value.server_code == ErrorCode.MonthlyContributorsLimitHit.value
27472754
assert e.value.detail == (
2748-
"Maximum number of workspace contributors is reached. Please upgrade your subscription to push changes or create projects. (MonthlyContributorsLimitHit)"
2755+
"Maximum number of workspace contributors is reached. Please upgrade your subscription to push changes or create projects. (MonthlyContributorsLimitHit)"
27492756
)
27502757
assert e.value.http_error == 422
27512758
assert e.value.http_method == "POST"
27522759
assert e.value.contributors_quota == 0
27532760
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
2761+
2762+
2763+
def dummy_mcStorage():
2764+
client = create_client(API_USER, USER_PWD)
2765+
workspace_name = create_workspace_for_client(client, STORAGE_WORKSPACE)
2766+
print(workspace_name)
2767+
client_workspace = None
2768+
for workspace in client.workspaces_list():
2769+
if workspace["name"] == workspace_name:
2770+
client_workspace = workspace
2771+
break
2772+
client_workspace_id = client_workspace["id"]
2773+
client_workspace_storage = client_workspace["storage"]
2774+
2775+
client.patch(
2776+
f"/v1/tests/workspaces/{client_workspace_id}",
2777+
{
2778+
"limits_override": {
2779+
"storage": client_workspace_storage,
2780+
"projects": 1,
2781+
"monthly_contributors": 500,
2782+
"api_allowed": True,
2783+
}
2784+
},
2785+
{"Content-Type": "application/json"},
2786+
)
2787+
2788+
return client

0 commit comments

Comments
 (0)