Merge pull request #13125 from edx/renzo/multiple-program-types
Allow program listing page to display programs from any category
This commit is contained in:
@@ -889,7 +889,7 @@ class AnonymousLookupTable(ModuleStoreTestCase):
|
||||
self.assertEqual(anonymous_id, anonymous_id_for_user(self.user, course2.id, save=False))
|
||||
|
||||
|
||||
# TODO: Clean up these tests so that they use program factories.
|
||||
# TODO: Clean up these tests so that they use program factories and don't mention XSeries!
|
||||
@attr('shard_3')
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
@ddt.ddt
|
||||
@@ -907,8 +907,7 @@ class DashboardTestXSeriesPrograms(ModuleStoreTestCase, ProgramsApiConfigMixin):
|
||||
self.course_2 = CourseFactory.create()
|
||||
self.course_3 = CourseFactory.create()
|
||||
self.program_name = 'Testing Program'
|
||||
self.category = 'xseries'
|
||||
self.display_category = 'XSeries'
|
||||
self.category = 'XSeries'
|
||||
|
||||
CourseModeFactory.create(
|
||||
course_id=self.course_1.id,
|
||||
@@ -990,8 +989,7 @@ class DashboardTestXSeriesPrograms(ModuleStoreTestCase, ProgramsApiConfigMixin):
|
||||
self.assertEqual(
|
||||
{
|
||||
u'edx/demox/Run_1': {
|
||||
'category': 'xseries',
|
||||
'display_category': 'XSeries',
|
||||
'category': self.category,
|
||||
'course_program_list': [{
|
||||
'program_id': 0,
|
||||
'course_count': len(course_codes),
|
||||
@@ -1150,11 +1148,17 @@ class DashboardTestXSeriesPrograms(ModuleStoreTestCase, ProgramsApiConfigMixin):
|
||||
"""
|
||||
self.assertContains(response, 'label-xseries-association', count)
|
||||
self.assertContains(response, 'btn xseries-', count)
|
||||
self.assertContains(response, 'XSeries Program Course', count)
|
||||
self.assertContains(response, 'XSeries Program: Interested in more courses in this subject?', count)
|
||||
|
||||
self.assertContains(response, '{category} Program Course'.format(category=self.category), count)
|
||||
self.assertContains(
|
||||
response,
|
||||
'{category} Program: Interested in more courses in this subject?'.format(category=self.category),
|
||||
count
|
||||
)
|
||||
self.assertContains(response, 'View {category} Details'.format(category=self.category), count)
|
||||
|
||||
self.assertContains(response, 'This course is 1 of 3 courses in the', count)
|
||||
self.assertContains(response, self.program_name, count * 2)
|
||||
self.assertContains(response, 'View XSeries Details', count)
|
||||
|
||||
|
||||
class UserAttributeTests(TestCase):
|
||||
|
||||
@@ -120,7 +120,7 @@ from notification_prefs.views import enable_notifications
|
||||
|
||||
from openedx.core.djangoapps.credit.email_utils import get_credit_provider_display_names, make_providers_strings
|
||||
from openedx.core.djangoapps.user_api.preferences import api as preferences_api
|
||||
from openedx.core.djangoapps.programs.utils import get_programs_for_dashboard, get_display_category
|
||||
from openedx.core.djangoapps.programs.utils import get_programs_for_dashboard
|
||||
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.theming import helpers as theming_helpers
|
||||
@@ -2497,7 +2497,7 @@ def _get_course_programs(user, user_enrolled_courses): # pylint: disable=invali
|
||||
|
||||
for course_key, programs in course_programs.viewitems():
|
||||
for program in programs:
|
||||
if program.get('status') == 'active' and program.get('category') == 'xseries':
|
||||
if program.get('status') == 'active' and program.get('category') == 'XSeries':
|
||||
try:
|
||||
programs_for_course = programs_data.setdefault(course_key, {})
|
||||
programs_for_course.setdefault('course_program_list', []).append({
|
||||
@@ -2510,7 +2510,6 @@ def _get_course_programs(user, user_enrolled_courses): # pylint: disable=invali
|
||||
).format(program['marketing_slug'])
|
||||
})
|
||||
programs_for_course['category'] = program.get('category')
|
||||
programs_for_course['display_category'] = get_display_category(program)
|
||||
except KeyError:
|
||||
log.warning('Program structure is invalid, skipping display: %r', program)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user