Skip to content

Commit

Permalink
Makes regen_user fn respect ENABLE_OPENBADGES
Browse files Browse the repository at this point in the history
- Uses pre-existing function to check if badging is enabled
- Patch ENABLE_OPENBADGES for failing test
  • Loading branch information
Giulio Gratta authored and clintonb committed Nov 1, 2017
1 parent 5026b4f commit 908d5f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from opaque_keys.edx.keys import CourseKey

from badges.events.course_complete import get_completion_badge
from badges.utils import badges_enabled
from certificates.api import regenerate_user_certificates
from xmodule.modulestore.django import modulestore

Expand Down Expand Up @@ -100,7 +101,7 @@ def handle(self, *args, **options):
course_id
)

if course.issue_badges:
if badges_enabled() and course.issue_badges:
badge_class = get_completion_badge(course_id, student)
badge = badge_class.get_for_user(student)

Expand Down
1 change: 1 addition & 0 deletions lms/djangoapps/certificates/tests/test_cert_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def setUp(self):

@ddt.data(True, False)
@override_settings(CERT_QUEUE='test-queue')
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_OPENBADGES': True})
@patch('certificates.api.XQueueCertInterface', spec=True)
def test_clear_badge(self, issue_badges, xqueue):
"""
Expand Down

0 comments on commit 908d5f9

Please sign in to comment.