Remove unused "has_cert_config" field on CourseDetails.
This commit is contained in:
@@ -982,40 +982,6 @@ class CourseMetadataEditingTest(CourseTestCase):
|
||||
tab_list.append(self.notes_tab)
|
||||
self.assertEqual(tab_list, course.tabs)
|
||||
|
||||
@override_settings(FEATURES={'CERTIFICATES_HTML_VIEW': True})
|
||||
def test_web_view_certificate_configuration_settings(self):
|
||||
"""
|
||||
Test that has_cert_config is updated based on cert_html_view_enabled setting.
|
||||
"""
|
||||
test_model = CourseMetadata.update_from_json(
|
||||
self.course,
|
||||
{
|
||||
"cert_html_view_enabled": {"value": "true"}
|
||||
},
|
||||
user=self.user
|
||||
)
|
||||
self.assertIn('cert_html_view_enabled', test_model)
|
||||
url = get_url(self.course.id)
|
||||
response = self.client.get_json(url)
|
||||
course_detail_json = json.loads(response.content)
|
||||
self.assertFalse(course_detail_json['has_cert_config'])
|
||||
|
||||
# Now add a certificate configuration
|
||||
certificates = [
|
||||
{
|
||||
'id': 1,
|
||||
'name': 'Certificate Config Name',
|
||||
'course_title': 'Title override',
|
||||
'signatories': [],
|
||||
'is_active': True
|
||||
}
|
||||
]
|
||||
self.course.certificates = {'certificates': certificates}
|
||||
modulestore().update_item(self.course, self.user.id)
|
||||
response = self.client.get_json(url)
|
||||
course_detail_json = json.loads(response.content)
|
||||
self.assertTrue(course_detail_json['has_cert_config'])
|
||||
|
||||
|
||||
class CourseGraderUpdatesTest(CourseTestCase):
|
||||
"""
|
||||
|
||||
@@ -31,8 +31,7 @@ define([
|
||||
entrance_exam_enabled : '',
|
||||
entrance_exam_minimum_score_pct: '50',
|
||||
license: null,
|
||||
language: '',
|
||||
has_cert_config: false
|
||||
language: ''
|
||||
},
|
||||
mockSettingsPage = readFixtures('mock/mock-settings-page.underscore');
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ class CourseDetails(object):
|
||||
'ENTRANCE_EXAM_MIN_SCORE_PCT',
|
||||
'50'
|
||||
) # minimum passing score for entrance exam content module/tree,
|
||||
self.has_cert_config = None # course has active certificate configuration
|
||||
self.self_paced = None
|
||||
|
||||
@classmethod
|
||||
@@ -94,7 +93,6 @@ class CourseDetails(object):
|
||||
# Default course license is "All Rights Reserved"
|
||||
course_details.license = getattr(descriptor, "license", "all-rights-reserved")
|
||||
|
||||
course_details.has_cert_config = has_active_web_certificate(descriptor)
|
||||
course_details.intro_video = cls.fetch_youtube_video_id(course_key)
|
||||
|
||||
for attribute in ABOUT_ATTRIBUTES:
|
||||
@@ -290,23 +288,3 @@ class CourseDetails(object):
|
||||
'?rel=0" frameborder="0" allowfullscreen=""></iframe>'
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
# TODO - we may no longer need this - check with Zia
|
||||
def has_active_web_certificate(course):
|
||||
"""
|
||||
Returns True if given course has active web certificate
|
||||
configuration. If given course has no active web certificate
|
||||
configuration returns False. Returns None If `CERTIFICATES_HTML_VIEW`
|
||||
is not enabled or course has not enabled `cert_html_view_enabled`
|
||||
settings.
|
||||
"""
|
||||
cert_config = None
|
||||
if settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False) and course.cert_html_view_enabled:
|
||||
cert_config = False
|
||||
certificates = getattr(course, 'certificates', {})
|
||||
configurations = certificates.get('certificates', [])
|
||||
for config in configurations:
|
||||
if config.get('is_active'):
|
||||
return True
|
||||
return cert_config
|
||||
|
||||
@@ -39,7 +39,6 @@ class CourseDetailsTestCase(ModuleStoreTestCase):
|
||||
self.assertIsNone(details.intro_video, "intro_video somehow initialized" + str(details.intro_video))
|
||||
self.assertIsNone(details.effort, "effort somehow initialized" + str(details.effort))
|
||||
self.assertIsNone(details.language, "language somehow initialized" + str(details.language))
|
||||
self.assertIsNone(details.has_cert_config)
|
||||
self.assertFalse(details.self_paced)
|
||||
|
||||
def test_update_and_fetch(self):
|
||||
|
||||
Reference in New Issue
Block a user