Skip to content

Commit 4ce61f4

Browse files
authored
feat: add WORKSPACE visibility for projects (#421)
* feat: add WORKSPACE visibility for projects * tests: projects are now private by default, follow that in tests
1 parent 6d6e1e7 commit 4ce61f4

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/specklepy/core/api/enums.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33

44
class ProjectVisibility(str, Enum):
5+
"""Supported project visibility types"""
6+
57
PRIVATE = "PRIVATE"
68
PUBLIC = "PUBLIC"
79
UNLISTED = "UNLISTED"
10+
WORKSPACE = "WORKSPACE"
11+
12+
13+
foo = ProjectVisibility.PRIVATE
814

915

1016
class UserProjectsUpdatedMessageType(str, Enum):

tests/integration/client/current/test_project_invite_resource.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44

55
from specklepy.api.client import SpeckleClient
6+
from specklepy.core.api.enums import ProjectVisibility
67
from specklepy.core.api.inputs.project_inputs import (
78
ProjectCreateInput,
89
ProjectInviteCreateInput,
@@ -22,7 +23,9 @@ class TestProjectInviteResource:
2223
@pytest.fixture
2324
def project(self, client: SpeckleClient):
2425
return client.project.create(
25-
ProjectCreateInput(name="test", description=None, visibility=None)
26+
ProjectCreateInput(
27+
name="test", description=None, visibility=ProjectVisibility.PUBLIC
28+
)
2629
)
2730

2831
@pytest.fixture

tests/integration/client/current/test_project_resource.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def test_project_create(
5151
assert result.name == name
5252
assert result.description == (description or "")
5353
# we've disabled creation of public projects for now, they fall back to unlisted
54-
if visibility == ProjectVisibility.PUBLIC:
55-
assert result.visibility == ProjectVisibility.UNLISTED
54+
if visibility == ProjectVisibility.UNLISTED:
55+
assert result.visibility == ProjectVisibility.PUBLIC
5656
else:
5757
assert result.visibility == visibility
5858

@@ -78,7 +78,7 @@ def test_project_get_permissions(
7878
def test_project_update(self, client: SpeckleClient, test_project: Project):
7979
new_name = "MY new name"
8080
new_description = "MY new desc"
81-
new_visibility = ProjectVisibility.PUBLIC
81+
new_visibility = ProjectVisibility.UNLISTED
8282

8383
update_data = ProjectUpdateInput(
8484
id=test_project.id,
@@ -94,8 +94,8 @@ def test_project_update(self, client: SpeckleClient, test_project: Project):
9494
assert updated_project.name == new_name
9595
assert updated_project.description == new_description
9696
# we've disabled creation of public projects for now, they fall back to unlisted
97-
if new_visibility == ProjectVisibility.PUBLIC:
98-
assert updated_project.visibility == ProjectVisibility.UNLISTED
97+
if new_visibility == ProjectVisibility.UNLISTED:
98+
assert updated_project.visibility == ProjectVisibility.PUBLIC
9999
else:
100100
assert updated_project.visibility == new_visibility
101101

0 commit comments

Comments
 (0)