Skip to content

Commit c28a0b7

Browse files
authored
[SILO-700] chore: improve tests for module and cycles feature check (#10)
1 parent ac86f80 commit c28a0b7

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

plane/models/projects.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ class ProjectFeature(BaseModel):
140140

141141
model_config = ConfigDict(extra="allow", populate_by_name=True)
142142

143-
epics: bool
144-
modules: bool
145-
cycles: bool
146-
views: bool
147-
pages: bool
148-
intakes: bool
149-
work_item_types: bool
143+
epics: bool | None = None
144+
modules: bool | None = None
145+
cycles: bool | None = None
146+
views: bool | None = None
147+
pages: bool | None = None
148+
intakes: bool | None = None
149+
work_item_types: bool | None = None

tests/unit/test_cycles.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from plane.client import PlaneClient
88
from plane.models.cycles import CreateCycle, UpdateCycle
9-
from plane.models.projects import Project
9+
from plane.models.projects import Project, ProjectFeature
1010

1111

1212
class TestCyclesAPI:
@@ -60,6 +60,7 @@ def cycle(
6060
cycle_data: CreateCycle,
6161
):
6262
"""Create a test cycle and yield it, then delete it."""
63+
client.projects.update_features(workspace_slug, project.id, ProjectFeature(cycles=True))
6364
cycle = client.cycles.create(workspace_slug, project.id, cycle_data)
6465
yield cycle
6566
try:
@@ -75,6 +76,7 @@ def test_create_cycle(
7576
cycle_data: CreateCycle,
7677
) -> None:
7778
"""Test creating a cycle."""
79+
client.projects.update_features(workspace_slug, project.id, ProjectFeature(cycles=True))
7880
cycle = client.cycles.create(workspace_slug, project.id, cycle_data)
7981
assert cycle is not None
8082
assert cycle.id is not None

tests/unit/test_intake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from plane.client import PlaneClient
66
from plane.models.intake import CreateIntakeWorkItem
7-
from plane.models.projects import Project
7+
from plane.models.projects import Project, ProjectFeature
88

99

1010
class TestIntakeAPI:

tests/unit/test_modules.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from plane.client import PlaneClient
88
from plane.models.enums import ModuleStatus
99
from plane.models.modules import CreateModule, UpdateModule
10-
from plane.models.projects import Project
10+
from plane.models.projects import Project, ProjectFeature
1111

1212

1313
class TestModulesAPI:
@@ -61,6 +61,7 @@ def module(
6161
module_data: CreateModule,
6262
):
6363
"""Create a test module and yield it, then delete it."""
64+
client.projects.update_features(workspace_slug, project.id, ProjectFeature(modules=True))
6465
module = client.modules.create(workspace_slug, project.id, module_data)
6566
yield module
6667
try:
@@ -76,6 +77,7 @@ def test_create_module(
7677
module_data: CreateModule,
7778
) -> None:
7879
"""Test creating a module."""
80+
client.projects.update_features(workspace_slug, project.id, ProjectFeature(modules=True))
7981
module = client.modules.create(workspace_slug, project.id, module_data)
8082
assert module is not None
8183
assert module.id is not None

0 commit comments

Comments
 (0)