Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ce61f4e89 | |||
| 6d6e1e7650 |
@@ -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):
|
||||
|
||||
@@ -155,6 +155,8 @@ class ModelWithVersions(Model):
|
||||
class ProjectPermissionChecks(GraphQLBaseModel):
|
||||
can_create_model: "PermissionCheckResult"
|
||||
can_delete: "PermissionCheckResult"
|
||||
can_load: "PermissionCheckResult"
|
||||
can_publish: "PermissionCheckResult"
|
||||
|
||||
|
||||
class Project(GraphQLBaseModel):
|
||||
|
||||
@@ -73,6 +73,16 @@ class ProjectResource(ResourceBase):
|
||||
code
|
||||
message
|
||||
}
|
||||
canLoad {
|
||||
authorized
|
||||
code
|
||||
message
|
||||
}
|
||||
canPublish {
|
||||
authorized
|
||||
code
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user