Commit f2f44312 by Awais

ECOM-1600 fixing certs button issue.

parent a4dd6e56
......@@ -846,6 +846,8 @@ class IsCoursePassedTests(ModuleStoreTestCase):
Tests for the is_course_passed helper function
"""
SUCCESS_CUTOFF = 0.5
def setUp(self):
super(IsCoursePassedTests, self).setUp()
......@@ -854,7 +856,7 @@ class IsCoursePassedTests(ModuleStoreTestCase):
org='edx',
number='verified',
display_name='Verified Course',
grade_cutoffs={'cutoff': 0.75, 'Pass': 0.5}
grade_cutoffs={'cutoff': 0.75, 'Pass': self.SUCCESS_CUTOFF}
)
self.request = RequestFactory()
......@@ -874,6 +876,13 @@ class IsCoursePassedTests(ModuleStoreTestCase):
# If user has below passing marks then False will return
self.assertFalse(views.is_course_passed(self.course, None, self.student, self.request))
@patch('courseware.grades.grade', Mock(return_value={'percent': SUCCESS_CUTOFF}))
def test_user_with_passing_marks_and_achieved_marks_equal(self):
# Mocking the grades.grade
# If user's achieved passing marks are equal to the required passing
# marks then it will return True
self.assertTrue(views.is_course_passed(self.course, None, self.student, self.request))
@attr('shard_1')
class GenerateUserCertTests(ModuleStoreTestCase):
......
......@@ -1302,7 +1302,7 @@ def is_course_passed(course, grade_summary=None, student=None, request=None):
if grade_summary is None:
grade_summary = grades.grade(student, request, course)
return success_cutoff and grade_summary['percent'] > success_cutoff
return success_cutoff and grade_summary['percent'] >= success_cutoff
@require_POST
......
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