Skip to content
Merged
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
19 changes: 10 additions & 9 deletions mergin/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2777,14 +2777,6 @@ def test_access_management(mc: MerginClient, mc2: MerginClient):
# test permissions - a different client cannot update the role
with pytest.raises(ClientError, match=f"You do not have admin permissions to workspace"):
mc2.update_workspace_member(workspace_id, new_user["id"], ws_role)
# remove workspace member
mc.remove_workspace_member(workspace_id, new_user["id"])
workspace_members = mc.list_workspace_members(workspace_id)
assert not any(m["id"] == new_user["id"] for m in workspace_members)
# duplicated call
with pytest.raises(ClientError) as exc_info:
mc.remove_workspace_member(workspace_id, new_user["id"])
assert exc_info.value.http_error == 404
# add project
test_project_name = "test_collaborators"
test_project_fullname = API_USER + "/" + test_project_name
Expand All @@ -2810,7 +2802,8 @@ def test_access_management(mc: MerginClient, mc2: MerginClient):
collaborators = mc.list_project_collaborators(test_project_id)
updated_collaborator = next((c for c in collaborators if c["id"] == new_user["id"]))
assert updated_collaborator["project_role"] == updated_role.value
# remove project collaborator
# remove project collaborator, add this user guest first to make sure it can be removed from project collaborators
mc.update_workspace_member(workspace_id, new_user["id"], WorkspaceRole.GUEST)
mc.remove_project_collaborator(test_project_id, new_user["id"])
collaborators = mc.list_project_collaborators(test_project_id)
assert not any(c["id"] == new_user["id"] for c in collaborators)
Expand All @@ -2832,3 +2825,11 @@ def test_access_management(mc: MerginClient, mc2: MerginClient):
{"limits_override": {"projects": orig_projects_limit}},
json_headers,
)
# remove workspace member
mc.remove_workspace_member(workspace_id, new_user["id"])
workspace_members = mc.list_workspace_members(workspace_id)
assert not any(m["id"] == new_user["id"] for m in workspace_members)
# duplicated call
with pytest.raises(ClientError) as exc_info:
mc.remove_workspace_member(workspace_id, new_user["id"])
assert exc_info.value.http_error == 404