Commit 22d3b028 by rabiaiftikhar

respond to comments

parent b84d4c02
......@@ -22,19 +22,21 @@ class SelfGeneratedCertsSignalTest(ModuleStoreTestCase):
# Enable the feature
CertificateGenerationConfiguration.objects.create(enabled=True)
def test_cert_generation_flag_on_pacing_toggle(self):
"""
Verify that signal enables or disables self-generated certificates
according to course-pacing.
"""
#self-generation of cert disables by default
self.assertFalse(certs_api.cert_generation_enabled(self.course.id))
_listen_for_course_pacing_changed('store', self.course.id, self.course.self_paced)
#verify that self-generation of cert is enabled for self-paced course
self.assertTrue(certs_api.cert_generation_enabled(self.course.id))
self.course.self_paced = False
self.store.update_item(self.course, self.user.id)
_listen_for_course_pacing_changed('store', self.course.id, self.course.self_paced)
# verify that self-generation of cert is disabled for instructor-paced course
self.assertFalse(certs_api.cert_generation_enabled(self.course.id))
......@@ -280,6 +280,10 @@ class CourseDetails(object):
if dirty:
module_store.update_item(descriptor, user.id)
# fires a signal indicating that the course pacing has changed
if is_pacing_changed:
COURSE_PACING_CHANGE.send(sender=None, course_key=course_key, course_self_paced=descriptor.self_paced)
# NOTE: below auto writes to the db w/o verifying that any of
# the fields actually changed to make faster, could compare
# against db or could have client send over a list of which
......@@ -290,10 +294,6 @@ class CourseDetails(object):
cls.update_about_video(descriptor, jsondict['intro_video'], user.id)
# fires the signal that course pacing has changed after changes are reflected in db
if is_pacing_changed:
COURSE_PACING_CHANGE.send(sender=None, course_key=course_key, course_self_paced=descriptor.self_paced)
# Could just return jsondict w/o doing any db reads, but I put
# the reads in as a means to confirm it persisted correctly
return CourseDetails.fetch(course_key)
......
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