Skip to content

Commit 413ada4

Browse files
committed
Merge branch 'master' into revert-monthly-contributor
2 parents 41ae3ac + 0413f86 commit 413ada4

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

mergin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def workspace_service(self, workspace_id):
298298
Returns response from server as JSON dict or None if endpoint is not found
299299
"""
300300
resp = self.get(f"/v1/workspace/{workspace_id}/service")
301-
return json.loads(resp)
301+
return json.load(resp)
302302

303303
def workspace_usage(self, workspace_id):
304304
"""

mergin/test/test_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,3 +2717,28 @@ def test_error_projects_limit_hit(mcStorage: MerginClient):
27172717
assert e.value.http_error == 422
27182718
assert e.value.http_method == "POST"
27192719
assert e.value.url == f"{mcStorage.url}v1/project/testpluginstorage"
2720+
2721+
def test_workspace_requests(mc2: MerginClient):
2722+
test_project = "test_permissions"
2723+
test_project_fullname = API_USER2 + "/" + test_project
2724+
2725+
project_info = mc2.project_info(test_project_fullname)
2726+
ws_id = project_info.get("workspace_id")
2727+
2728+
usage = mc2.workspace_usage(ws_id)
2729+
# Check type and common value
2730+
assert type(usage) == dict
2731+
assert usage["api"]["allowed"] == True
2732+
assert usage["history"]["quota"] == 214748364800
2733+
assert usage["history"]["usage"] == 0
2734+
2735+
service = mc2.workspace_service(ws_id)
2736+
# Check type and common value
2737+
assert type(service) == dict
2738+
assert service["action_required"] == False
2739+
assert service["plan"]
2740+
assert service["plan"]["is_paid_plan"] == False
2741+
assert service["plan"]["product_id"] == None
2742+
assert service["plan"]["type"] == "custom"
2743+
assert service["subscription"] == None
2744+

0 commit comments

Comments
 (0)