Commit 579ce168 by Clinton Blackburn

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
parent 0fe4611d
...@@ -37,7 +37,7 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase): ...@@ -37,7 +37,7 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase):
UserFactory(username=self.catalog_integration.service_username) 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.""" """Verify that API data retrieval utility is used correctly."""
args, kwargs = call_args args, kwargs = call_args
...@@ -58,12 +58,9 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase): ...@@ -58,12 +58,9 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase):
self.assertEqual(kwargs['api']._store['base_url'], self.catalog_integration.internal_api_url) # pylint: disable=protected-access 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 = { querystring = {
'marketable': 1,
'exclude_utm': 1, 'exclude_utm': 1,
'status': ('active', 'retired',),
} }
if program_uuid: if program_uuid:
querystring['use_full_course_serializer'] = 1 querystring['use_full_course_serializer'] = 1
...@@ -83,21 +80,6 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase): ...@@ -83,21 +80,6 @@ class TestGetPrograms(CatalogIntegrationMixin, TestCase):
self.assert_contract(mock_get_edx_api_data.call_args) self.assert_contract(mock_get_edx_api_data.call_args)
self.assertEqual(data, programs) 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): def test_get_one_program(self, mock_get_edx_api_data):
program = ProgramFactory() program = ProgramFactory()
mock_get_edx_api_data.return_value = program mock_get_edx_api_data.return_value = program
......
...@@ -56,14 +56,9 @@ def get_programs(uuid=None, types=None): # pylint: disable=redefined-builtin ...@@ -56,14 +56,9 @@ def get_programs(uuid=None, types=None): # pylint: disable=redefined-builtin
querystring = { querystring = {
'exclude_utm': 1, '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: if uuid:
querystring['use_full_course_serializer'] = 1 querystring['use_full_course_serializer'] = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment