Skip to content

Fail in last PR regarding the use of json module #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def workspace_service(self, workspace_id):
Returns response from server as JSON dict or None if endpoint is not found
"""
resp = self.get(f"/v1/workspace/{workspace_id}/service")
return json.loads(resp)
return json.load(resp)

def workspace_usage(self, workspace_id):
"""
Expand Down
25 changes: 25 additions & 0 deletions mergin/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2754,3 +2754,28 @@ def test_error_monthly_contributors_limit_hit(mcStorage: MerginClient):
assert e.value.http_method == "POST"
assert e.value.url == f"{mcStorage.url}v1/project/push/testpluginstorage/{test_project}"
assert e.value.server_response.get("contributors_quota") == 0


def test_workspace_requests(mc2: MerginClient):
test_project = "test_permissions"
test_project_fullname = API_USER2 + "/" + test_project

project_info = mc2.project_info(test_project_fullname)
ws_id = project_info.get("workspace_id")

usage = mc2.workspace_usage(ws_id)
# Check type and common value
assert type(usage) == dict
assert usage["api"]["allowed"] == True
assert usage["history"]["quota"] == 214748364800
assert usage["history"]["usage"] == 0

service = mc2.workspace_service(ws_id)
# Check type and common value
assert type(service) == dict
assert service["action_required"] == False
assert service["plan"]
assert service["plan"]["is_paid_plan"] == False
assert service["plan"]["product_id"] == None
assert service["plan"]["type"] == "custom"
assert service["subscription"] == None
Loading