feat: TNL-10136 Propagate changes from last PR

This commit is contained in:
Bernard Szabo
2022-11-25 07:36:43 -05:00
committed by bszabo
parent d5a5e25fef
commit 377edc2f4d
17 changed files with 47 additions and 58 deletions

View File

@@ -301,7 +301,8 @@ class CourseApiTestViews(BaseCoursewareTests, MasqueradeMixin):
""" Test that metadata endpoint returns data for the streak celebration """
CourseEnrollment.enroll(self.user, self.course.id, 'audit')
with override_waffle_flag(COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT, active=True):
with mock.patch('common.djangoapps.student.models.UserCelebration.perform_streak_updates', return_value=3):
UPDATE_MTHD_NAME = 'common.djangoapps.student.models.user.UserCelebration.perform_streak_updates'
with mock.patch(UPDATE_MTHD_NAME, return_value=3):
response = self.client.get(self.url, content_type='application/json')
celebrations = response.json()['celebrations']
assert celebrations['streak_length_to_celebrate'] == 3
@@ -311,7 +312,8 @@ class CourseApiTestViews(BaseCoursewareTests, MasqueradeMixin):
""" Test that metadata endpoint does not return a discount and signal is not sent if flag is not set """
CourseEnrollment.enroll(self.user, self.course.id, 'audit')
with override_waffle_flag(COURSEWARE_MFE_MILESTONES_STREAK_DISCOUNT, active=False):
with mock.patch('common.djangoapps.student.models.UserCelebration.perform_streak_updates', return_value=3):
UPDATE_MTHD_NAME = 'common.djangoapps.student.models.user.UserCelebration.perform_streak_updates'
with mock.patch(UPDATE_MTHD_NAME, return_value=3):
response = self.client.get(self.url, content_type='application/json')
celebrations = response.json()['celebrations']
assert celebrations['streak_length_to_celebrate'] == 3