Skip to content

Commit

Permalink
feat: Create change requests for segments (#4265)
Browse files Browse the repository at this point in the history
Co-authored-by: Kim Gustyr <kim.gustyr@flagsmith.com>
Co-authored-by: Matthew Elwell <matthew.elwell@flagsmith.com>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 42ef04b commit 355f4e2
Show file tree
Hide file tree
Showing 99 changed files with 1,067 additions and 856 deletions.
2 changes: 1 addition & 1 deletion api/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
if settings.SAML_INSTALLED:
urlpatterns.append(path("api/v1/auth/saml/", include("saml.urls")))

if settings.WORKFLOWS_LOGIC_INSTALLED:
if settings.WORKFLOWS_LOGIC_INSTALLED: # pragma: no cover
workflow_views = importlib.import_module("workflows_logic.views")
urlpatterns.extend(
[
Expand Down
2 changes: 1 addition & 1 deletion api/audit/permissions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from common.projects.permissions import VIEW_AUDIT_LOG
from django.views import View
from rest_framework.permissions import BasePermission
from rest_framework.request import Request

from organisations.models import Organisation
from projects.models import Project
from projects.permissions import VIEW_AUDIT_LOG


class OrganisationAuditLogPermissions(BasePermission):
Expand Down
21 changes: 14 additions & 7 deletions api/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

import boto3
import pytest
from common.environments.permissions import (
MANAGE_IDENTITIES,
VIEW_ENVIRONMENT,
VIEW_IDENTITIES,
)
from common.projects.permissions import VIEW_PROJECT
from django.contrib.contenttypes.models import ContentType
from django.core.cache import caches
from django.db.backends.base.creation import TEST_DATABASE_PREFIX
Expand All @@ -27,11 +33,6 @@
from environments.identities.models import Identity
from environments.identities.traits.models import Trait
from environments.models import Environment, EnvironmentAPIKey
from environments.permissions.constants import (
MANAGE_IDENTITIES,
VIEW_ENVIRONMENT,
VIEW_IDENTITIES,
)
from environments.permissions.models import (
UserEnvironmentPermission,
UserPermissionGroupEnvironmentPermission,
Expand Down Expand Up @@ -72,7 +73,6 @@
UserPermissionGroupProjectPermission,
UserProjectPermission,
)
from projects.permissions import VIEW_PROJECT
from projects.tags.models import Tag
from segments.models import Condition, Segment, SegmentRule
from tests.test_helpers import fix_issue_3869
Expand Down Expand Up @@ -547,12 +547,19 @@ def feature(project: Project, environment: Environment) -> Feature:


@pytest.fixture()
def change_request(environment, admin_user):
def change_request(environment: Environment, admin_user: FFAdminUser) -> ChangeRequest:
return ChangeRequest.objects.create(
environment=environment, title="Test CR", user_id=admin_user.id
)


@pytest.fixture()
def project_change_request(project: Project, admin_user: FFAdminUser) -> ChangeRequest:
return ChangeRequest.objects.create(
project=project, title="Test Project CR", user_id=admin_user.id
)


@pytest.fixture()
def feature_state(feature: Feature, environment: Environment) -> FeatureState:
return FeatureState.objects.get(environment=environment, feature=feature)
Expand Down
Loading

0 comments on commit 355f4e2

Please sign in to comment.