From 2914ee868db16affe2c7b39859b7e7a64fa0aec5 Mon Sep 17 00:00:00 2001 From: Pawel Szymanski Date: Fri, 15 Nov 2024 10:56:29 +0000 Subject: [PATCH] Remove feature flag for viewing legacy export wins. --- datahub/export_win/__init__.py | 3 --- datahub/export_win/test/test_win_views.py | 28 ++--------------------- datahub/export_win/views.py | 15 +----------- 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/datahub/export_win/__init__.py b/datahub/export_win/__init__.py index cc8f4dd06..e69de29bb 100644 --- a/datahub/export_win/__init__.py +++ b/datahub/export_win/__init__.py @@ -1,3 +0,0 @@ -EXPORT_WINS_LEGACY_DATA_FEATURE_FLAG_NAME = ( - 'export-wins-legacy-data', -) diff --git a/datahub/export_win/test/test_win_views.py b/datahub/export_win/test/test_win_views.py index 7ce6312d3..93d7c7734 100644 --- a/datahub/export_win/test/test_win_views.py +++ b/datahub/export_win/test/test_win_views.py @@ -36,9 +36,6 @@ create_test_user, format_date_or_datetime, ) -from datahub.export_win import ( - EXPORT_WINS_LEGACY_DATA_FEATURE_FLAG_NAME, -) from datahub.export_win.models import ( CustomerResponse, CustomerResponseToken, @@ -54,23 +51,11 @@ WinAdviserFactory, WinFactory, ) -from datahub.feature_flag.test.factories import UserFeatureFlagFactory from datahub.metadata.test.factories import TeamFactory pytestmark = pytest.mark.django_db -@pytest.fixture() -def export_wins_legacy_data_feature_flag(): - """ - Creates the Export wins legacy data user feature flag. - """ - yield UserFeatureFlagFactory( - code=EXPORT_WINS_LEGACY_DATA_FEATURE_FLAG_NAME, - is_active=True, - ) - - @pytest.fixture() def export_wins(): confirmed = CustomerResponseFactory.create_batch( @@ -476,17 +461,8 @@ def test_list(self): assert response_data['count'] == 2 - @pytest.mark.parametrize( - 'list_legacy_data', - ( - True, - False, - ), - ) - def test_list_with_legacy_wins(self, list_legacy_data, export_wins_legacy_data_feature_flag): + def test_list_with_legacy_wins(self): """Tests listing wins.""" - if list_legacy_data: - self.user.features.set([export_wins_legacy_data_feature_flag]) WinFactory.create_batch(2, adviser=self.user) WinFactory.create_batch(2, adviser=self.user, migrated_on=now()) url = reverse('api-v4:export-win:collection') @@ -495,7 +471,7 @@ def test_list_with_legacy_wins(self, list_legacy_data, export_wins_legacy_data_f assert response.status_code == status.HTTP_200_OK response_data = response.json() - assert response_data['count'] == (4 if list_legacy_data else 2) + assert response_data['count'] == 4 def test_list_default_sorting(self): """Tests wins are sorted.""" diff --git a/datahub/export_win/views.py b/datahub/export_win/views.py index 88efa9ff4..d235c7d2b 100644 --- a/datahub/export_win/views.py +++ b/datahub/export_win/views.py @@ -23,7 +23,6 @@ from datahub.core.schemas import StubSchema from datahub.core.viewsets import CoreViewSet -from datahub.export_win import EXPORT_WINS_LEGACY_DATA_FEATURE_FLAG_NAME from datahub.export_win.decorators import validate_script_and_html_tags from datahub.export_win.models import ( CustomerResponse, @@ -40,9 +39,7 @@ notify_export_win_email_by_rq_email, update_customer_response_token_for_email_notification_id, ) -from datahub.feature_flag.utils import ( - is_user_feature_flag_active, -) + logger = logging.getLogger(__name__) @@ -131,21 +128,11 @@ class WinViewSet(CoreViewSet): def get_queryset(self): """Filter the queryset to the authenticated user.""" - if is_user_feature_flag_active( - EXPORT_WINS_LEGACY_DATA_FEATURE_FLAG_NAME, - self.request.user, - ): - migrated_filter = {} - else: - migrated_filter = { - 'migrated_on__isnull': True, - } return ( super() .get_queryset() .filter( is_anonymous_win=False, - **migrated_filter, ) .exclude( ~Q(adviser=self.request.user),