Example #1
0
def handle_post_cert_generated(sender, instance, **kwargs):  # pylint: disable=unused-argument
    """
    Handles post_save signal of GeneratedCertificate, and mark user collected
    course milestone entry if user has passed the course.
    User is assumed to have passed the course if certificate status is either 'generating' or 'downloadable'.
    """
    allowed_cert_states = [CertificateStatuses.generating, CertificateStatuses.downloadable]
    if is_prerequisite_courses_enabled() and instance.status in allowed_cert_states:
        fulfill_course_milestone(instance.course_id, instance.user)
Example #2
0
def handle_post_cert_generated(sender, instance, **kwargs):  # pylint: disable=unused-argument
    """
    Handles post_save signal of GeneratedCertificate, and mark user collected
    course milestone entry if user has passed the course.
    User is assumed to have passed the course if certificate status is either 'generating' or 'downloadable'.
    """
    allowed_cert_states = [CertificateStatuses.generating, CertificateStatuses.downloadable]
    if is_prerequisite_courses_enabled() and instance.status in allowed_cert_states:
        fulfill_course_milestone(instance.course_id, instance.user)
Example #3
0
    def test_pre_requisite_courses_enabled(self, feature_flags):
        """
        Tests is_prerequisite_courses_enabled function with a set of possible values for
        ENABLE_PREREQUISITE_COURSES and MILESTONES_APP feature flags.
        """

        with patch.dict("django.conf.settings.FEATURES", {
            'ENABLE_PREREQUISITE_COURSES': feature_flags[0],
            'MILESTONES_APP': feature_flags[1]
        }):
            self.assertEqual(feature_flags[2], milestones_helpers.is_prerequisite_courses_enabled())
    def test_pre_requisite_courses_enabled(self, feature_flags):
        """
        Tests is_prerequisite_courses_enabled function with a set of possible values for
        ENABLE_PREREQUISITE_COURSES and MILESTONES_APP feature flags.
        """

        with patch.dict("django.conf.settings.FEATURES", {
            'ENABLE_PREREQUISITE_COURSES': feature_flags[0],
            'MILESTONES_APP': feature_flags[1]
        }):
            self.assertEqual(feature_flags[2], milestones_helpers.is_prerequisite_courses_enabled())
Example #5
0
 def _is_prerequisites_disabled():
     """
     Checks if prerequisites are disabled in the settings.
     """
     return ACCESS_DENIED if is_prerequisite_courses_enabled() else ACCESS_GRANTED
Example #6
0
def handle_course_cert_awarded(sender, user, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Mark a milestone entry if user has passed the course.
    """
    if is_prerequisite_courses_enabled():
        fulfill_course_milestone(course_key, user)
Example #7
0
def handle_course_cert_awarded(sender, user, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Mark a milestone entry if user has passed the course.
    """
    if is_prerequisite_courses_enabled():
        fulfill_course_milestone(course_key, user)