Allow to override COURSE_ENROLLMENT_MODES in AWS environment

Add more parameters to COURSE_ENROLLMENT_MODES to allow to display friendly mode name and more options

Fix python tests of PR #18557

PR #18557: Fix Diff Quality test line too long

PR #18557: Fix Diff Quality test unused-variable

Use six.iteritems() in COURSE_MODE_SLUG_CHOICES for future Python 3 compatibility
This commit is contained in:
mrey
2018-07-11 13:28:27 +02:00
parent 3e146b7af3
commit 9003a2dcde
8 changed files with 50 additions and 13 deletions

View File

@@ -197,9 +197,9 @@ class Command(BaseCommand):
# Add the enrollment track ids to a group access array
enrollment_track_group_access = []
if set_audit_enrollment_track:
enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['audit'])
enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['audit']['id'])
if set_verified_enrollment_track:
enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['verified'])
enrollment_track_group_access.append(settings.COURSE_ENROLLMENT_MODES['verified']['id'])
# If there are no errors, and either the audit track, or verified
# track needed an update, set the access, update and publish

View File

@@ -45,7 +45,7 @@ class EnrollmentTrackUserPartition(UserPartition):
return []
return [
Group(ENROLLMENT_GROUP_IDS[mode.slug], unicode(mode.name))
Group(ENROLLMENT_GROUP_IDS[mode.slug]["id"], unicode(mode.name))
for mode in CourseMode.modes_for_course(course_key, include_expired=True)
]
@@ -100,7 +100,7 @@ class EnrollmentTrackPartitionScheme(object):
course_mode = CourseMode.verified_mode_for_course(course_key, include_expired=True)
if not course_mode:
course_mode = CourseMode.DEFAULT_MODE
return Group(ENROLLMENT_GROUP_IDS[course_mode.slug], unicode(course_mode.name))
return Group(ENROLLMENT_GROUP_IDS[course_mode.slug]["id"], unicode(course_mode.name))
else:
return None

View File

@@ -69,7 +69,7 @@ class EnrollmentTrackUserPartitionTest(SharedModuleStoreTestCase):
with group IDs associated with cohort and random user partitions).
"""
for mode in ENROLLMENT_GROUP_IDS:
self.assertLess(ENROLLMENT_GROUP_IDS[mode], MINIMUM_STATIC_PARTITION_ID)
self.assertLess(ENROLLMENT_GROUP_IDS[mode]['id'], MINIMUM_STATIC_PARTITION_ID)
@staticmethod
def get_group_by_name(partition, name):