Allow program listing page to display programs from any category
This work removes most references to XSeries from the LMS in an attempt to be more general. ECOM-5018.
This commit is contained in:
@@ -13,7 +13,7 @@ class Program(factory.Factory):
|
||||
id = factory.Sequence(lambda n: n) # pylint: disable=invalid-name
|
||||
name = FuzzyText(prefix='Program ')
|
||||
subtitle = FuzzyText(prefix='Subtitle ')
|
||||
category = 'xseries'
|
||||
category = 'FooBar'
|
||||
status = 'unpublished'
|
||||
marketing_slug = FuzzyText(prefix='slug_')
|
||||
organizations = []
|
||||
|
||||
@@ -19,9 +19,9 @@ class ProgramsApiConfigMixin(object):
|
||||
'enable_student_dashboard': True,
|
||||
'enable_studio_tab': True,
|
||||
'enable_certification': True,
|
||||
'xseries_ad_enabled': True,
|
||||
'program_listing_enabled': True,
|
||||
'program_details_enabled': True,
|
||||
'marketing_path': 'foo',
|
||||
}
|
||||
|
||||
def create_programs_config(self, **kwargs):
|
||||
|
||||
@@ -93,24 +93,6 @@ class TestProgramRetrieval(ProgramsApiConfigMixin, ProgramsDataMixin, Credential
|
||||
# Verify the API was actually hit (not the cache).
|
||||
self.assertEqual(len(httpretty.httpretty.latest_requests), 1)
|
||||
|
||||
@ddt.data(True, False)
|
||||
def test_get_programs_category_casing(self, is_detail):
|
||||
"""Temporary. Verify that program categories are lowercased."""
|
||||
self.create_programs_config()
|
||||
|
||||
program = factories.Program(category='camelCase')
|
||||
|
||||
if is_detail:
|
||||
program_id = program['id']
|
||||
|
||||
self.mock_programs_api(data=program, program_id=program_id)
|
||||
data = utils.get_programs(self.user, program_id=program_id)
|
||||
self.assertEqual(data['category'], 'camelcase')
|
||||
else:
|
||||
self.mock_programs_api(data={'results': [program]})
|
||||
data = utils.get_programs(self.user)
|
||||
self.assertEqual(data[0]['category'], 'camelcase')
|
||||
|
||||
def test_get_programs_caching(self):
|
||||
"""Verify that when enabled, the cache is used for non-staff users."""
|
||||
self.create_programs_config(cache_ttl=1)
|
||||
@@ -235,18 +217,6 @@ class TestProgramRetrieval(ProgramsApiConfigMixin, ProgramsDataMixin, Credential
|
||||
actual = utils.get_programs_for_credentials(self.user, credential_data)
|
||||
self.assertEqual(actual, [])
|
||||
|
||||
def test_get_display_category_success(self):
|
||||
self.create_programs_config()
|
||||
self.mock_programs_api()
|
||||
actual_programs = utils.get_programs(self.user)
|
||||
for program in actual_programs:
|
||||
expected = 'XSeries'
|
||||
self.assertEqual(expected, utils.get_display_category(program))
|
||||
|
||||
def test_get_display_category_none(self):
|
||||
self.assertEqual('', utils.get_display_category(None))
|
||||
self.assertEqual('', utils.get_display_category({"id": "test"}))
|
||||
|
||||
|
||||
@skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
class GetCompletedCoursesTestCase(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user