Skip to content

Commit 52e42b2

Browse files
committed
TIL enable_features
1 parent bbd889b commit 52e42b2

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

api/tests/unit/features/test_unit_features_views.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from projects.tags.models import Tag
6363
from segments.models import Segment
6464
from tests.types import (
65+
EnableFeaturesFixture,
6566
WithEnvironmentPermissionsCallable,
6667
WithProjectPermissionsCallable,
6768
)
@@ -3582,15 +3583,15 @@ def test_list_features_with_filter_by_search_value_boolean( # noqa: FT003
35823583

35833584

35843585
def test_FeatureViewSet_list__code_references_ui_stats_enabled__returns_counts(
3586+
enable_features: EnableFeaturesFixture,
35853587
feature: Feature,
3586-
mocker: MockerFixture,
35873588
project: Project,
35883589
staff_client: APIClient,
35893590
with_project_permissions: WithProjectPermissionsCallable,
35903591
) -> None:
35913592
# Given
35923593
with_project_permissions([VIEW_PROJECT]) # type: ignore[call-arg]
3593-
mocker.patch.object(views, "is__code_references_ui_stats__enabled", return_value=True) # fmt: skip
3594+
enable_features("code_references_ui_stats")
35943595
with freeze_time("2099-01-01T10:00:00-0300"):
35953596
FeatureFlagCodeReferencesScan.objects.create(
35963597
project=project,
@@ -3670,15 +3671,15 @@ def test_FeatureViewSet_list__code_references_ui_stats_enabled__returns_counts(
36703671

36713672
@pytest.mark.usefixtures("feature")
36723673
def test_FeatureViewSet_list__no_code_reference_scans__returns_empty_counts(
3674+
enable_features: EnableFeaturesFixture,
36733675
environment: Environment,
3674-
mocker: MockerFixture,
36753676
project: Project,
36763677
staff_client: APIClient,
36773678
with_project_permissions: WithProjectPermissionsCallable,
36783679
) -> None:
36793680
# Given
36803681
with_project_permissions([VIEW_PROJECT]) # type: ignore[call-arg]
3681-
mocker.patch.object(views, "is__code_references_ui_stats__enabled", return_value=True) # fmt: skip
3682+
enable_features("code_references_ui_stats")
36823683

36833684
# When
36843685
response = staff_client.get(
@@ -3694,16 +3695,16 @@ def test_FeatureViewSet_list__no_code_reference_scans__returns_empty_counts(
36943695

36953696
# TODO: Delete this after https://github.com/flagsmith/flagsmith/issues/6832 is resolved
36963697
def test_FeatureViewSet_list__code_references_ui_stats_disabled__returns_empty_counts(
3698+
enable_features: EnableFeaturesFixture,
36973699
environment: Environment,
36983700
feature: Feature,
3699-
mocker: MockerFixture,
37003701
project: Project,
37013702
staff_client: APIClient,
37023703
with_project_permissions: WithProjectPermissionsCallable,
37033704
) -> None:
37043705
# Given
37053706
with_project_permissions([VIEW_PROJECT]) # type: ignore[call-arg]
3706-
mocker.patch.object(views, "is__code_references_ui_stats__enabled", return_value=False) # fmt: skip
3707+
enable_features() # code_references_ui_stats not enabled
37073708
FeatureFlagCodeReferencesScan.objects.create(
37083709
project=project,
37093710
repository_url="https://github.flagsmith.com/backend/",

0 commit comments

Comments
 (0)