From 4ce61f4e89ca1c8e2f419393bada7a390e43a6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= <57442769+gjedlicska@users.noreply.github.com> Date: Thu, 15 May 2025 14:35:54 +0200 Subject: [PATCH] feat: add WORKSPACE visibility for projects (#421) * feat: add WORKSPACE visibility for projects * tests: projects are now private by default, follow that in tests --- src/specklepy/core/api/enums.py | 6 ++++++ .../client/current/test_project_invite_resource.py | 5 ++++- .../client/current/test_project_resource.py | 10 +++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/specklepy/core/api/enums.py b/src/specklepy/core/api/enums.py index 00935b7..c079453 100644 --- a/src/specklepy/core/api/enums.py +++ b/src/specklepy/core/api/enums.py @@ -2,9 +2,15 @@ from enum import Enum class ProjectVisibility(str, Enum): + """Supported project visibility types""" + PRIVATE = "PRIVATE" PUBLIC = "PUBLIC" UNLISTED = "UNLISTED" + WORKSPACE = "WORKSPACE" + + +foo = ProjectVisibility.PRIVATE class UserProjectsUpdatedMessageType(str, Enum): diff --git a/tests/integration/client/current/test_project_invite_resource.py b/tests/integration/client/current/test_project_invite_resource.py index 33b3255..43c60d5 100644 --- a/tests/integration/client/current/test_project_invite_resource.py +++ b/tests/integration/client/current/test_project_invite_resource.py @@ -3,6 +3,7 @@ from typing import Optional import pytest from specklepy.api.client import SpeckleClient +from specklepy.core.api.enums import ProjectVisibility from specklepy.core.api.inputs.project_inputs import ( ProjectCreateInput, ProjectInviteCreateInput, @@ -22,7 +23,9 @@ class TestProjectInviteResource: @pytest.fixture def project(self, client: SpeckleClient): return client.project.create( - ProjectCreateInput(name="test", description=None, visibility=None) + ProjectCreateInput( + name="test", description=None, visibility=ProjectVisibility.PUBLIC + ) ) @pytest.fixture diff --git a/tests/integration/client/current/test_project_resource.py b/tests/integration/client/current/test_project_resource.py index b2b1bb7..bb5e611 100644 --- a/tests/integration/client/current/test_project_resource.py +++ b/tests/integration/client/current/test_project_resource.py @@ -51,8 +51,8 @@ class TestProjectResource: assert result.name == name assert result.description == (description or "") # we've disabled creation of public projects for now, they fall back to unlisted - if visibility == ProjectVisibility.PUBLIC: - assert result.visibility == ProjectVisibility.UNLISTED + if visibility == ProjectVisibility.UNLISTED: + assert result.visibility == ProjectVisibility.PUBLIC else: assert result.visibility == visibility @@ -78,7 +78,7 @@ class TestProjectResource: def test_project_update(self, client: SpeckleClient, test_project: Project): new_name = "MY new name" new_description = "MY new desc" - new_visibility = ProjectVisibility.PUBLIC + new_visibility = ProjectVisibility.UNLISTED update_data = ProjectUpdateInput( id=test_project.id, @@ -94,8 +94,8 @@ class TestProjectResource: assert updated_project.name == new_name assert updated_project.description == new_description # we've disabled creation of public projects for now, they fall back to unlisted - if new_visibility == ProjectVisibility.PUBLIC: - assert updated_project.visibility == ProjectVisibility.UNLISTED + if new_visibility == ProjectVisibility.UNLISTED: + assert updated_project.visibility == ProjectVisibility.PUBLIC else: assert updated_project.visibility == new_visibility