From 579ce168a70179d932d73d4a69e7fab75f3d2ab9 Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Tue, 11 Apr 2017 09:44:37 -0400 Subject: [PATCH] Removed switch display_retired_programs_on_learner_dashboard This functionality has been in production for a few days, and will not be disabled. This switch can now be removed. ECOM-7650 --- .../djangoapps/catalog/tests/test_utils.py | 36 +++++-------------- openedx/core/djangoapps/catalog/utils.py | 7 +--- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/openedx/core/djangoapps/catalog/tests/test_utils.py b/openedx/core/djangoapps/catalog/tests/test_utils.py index 7e674bf9ac..8c28dfd9ae 100644 --- a/openedx/core/djangoapps/catalog/tests/test_utils.py +++ b/openedx/core/djangoapps/catalog/tests/test_utils.py @@ -37,7 +37,7 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase): UserFactory(username=self.catalog_integration.service_username) - def assert_contract(self, call_args, program_uuid=None, types=None, expected_querystring=None): + def assert_contract(self, call_args, program_uuid=None, types=None): """Verify that API data retrieval utility is used correctly.""" args, kwargs = call_args @@ -58,17 +58,14 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase): self.assertEqual(kwargs['api']._store['base_url'], self.catalog_integration.internal_api_url) # pylint: disable=protected-access - if expected_querystring: - querystring = expected_querystring - else: - querystring = { - 'marketable': 1, - 'exclude_utm': 1, - } - if program_uuid: - querystring['use_full_course_serializer'] = 1 - if types: - querystring['types'] = types_param + querystring = { + 'exclude_utm': 1, + 'status': ('active', 'retired',), + } + if program_uuid: + querystring['use_full_course_serializer'] = 1 + if types: + querystring['types'] = types_param self.assertEqual(kwargs['querystring'], querystring) @@ -83,21 +80,6 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase): self.assert_contract(mock_get_edx_api_data.call_args) self.assertEqual(data, programs) - def test_get_programs_with_status_filtering(self, mock_get_edx_api_data): - """ The function should request active and retired programs when the Waffle switch is enabled. """ - programs = ProgramFactory.create_batch(3) - mock_get_edx_api_data.return_value = programs - - Switch.objects.get_or_create(name='display_retired_programs_on_learner_dashboard', defaults={'active': True}) - data = get_programs() - - expected_querystring = { - 'exclude_utm': 1, - 'status': ('active', 'retired',) - } - self.assert_contract(mock_get_edx_api_data.call_args, expected_querystring=expected_querystring) - self.assertEqual(data, programs) - def test_get_one_program(self, mock_get_edx_api_data): program = ProgramFactory() mock_get_edx_api_data.return_value = program diff --git a/openedx/core/djangoapps/catalog/utils.py b/openedx/core/djangoapps/catalog/utils.py index d915c25188..f77ad42165 100644 --- a/openedx/core/djangoapps/catalog/utils.py +++ b/openedx/core/djangoapps/catalog/utils.py @@ -56,14 +56,9 @@ def get_programs(uuid=None, types=None): # pylint: disable=redefined-builtin querystring = { 'exclude_utm': 1, + 'status': ('active', 'retired',), } - # TODO ECOM-7650: Remove this after https://github.com/edx/course-discovery/pull/805 is merged and released. - if waffle.switch_is_active('display_retired_programs_on_learner_dashboard'): - querystring['status'] = ('active', 'retired',) - else: - querystring['marketable'] = 1 - if uuid: querystring['use_full_course_serializer'] = 1