Commit 20b25356 by Awais Qureshi

Merge pull request #8144 from edx/awais786/ECOM-1600-gen-cert-btn-bug

ECOM-1600 fixing certs button issue.
parents a4dd6e56 f2f44312
...@@ -846,6 +846,8 @@ class IsCoursePassedTests(ModuleStoreTestCase): ...@@ -846,6 +846,8 @@ class IsCoursePassedTests(ModuleStoreTestCase):
Tests for the is_course_passed helper function Tests for the is_course_passed helper function
""" """
SUCCESS_CUTOFF = 0.5
def setUp(self): def setUp(self):
super(IsCoursePassedTests, self).setUp() super(IsCoursePassedTests, self).setUp()
...@@ -854,7 +856,7 @@ class IsCoursePassedTests(ModuleStoreTestCase): ...@@ -854,7 +856,7 @@ class IsCoursePassedTests(ModuleStoreTestCase):
org='edx', org='edx',
number='verified', number='verified',
display_name='Verified Course', display_name='Verified Course',
grade_cutoffs={'cutoff': 0.75, 'Pass': 0.5} grade_cutoffs={'cutoff': 0.75, 'Pass': self.SUCCESS_CUTOFF}
) )
self.request = RequestFactory() self.request = RequestFactory()
...@@ -874,6 +876,13 @@ class IsCoursePassedTests(ModuleStoreTestCase): ...@@ -874,6 +876,13 @@ class IsCoursePassedTests(ModuleStoreTestCase):
# If user has below passing marks then False will return # If user has below passing marks then False will return
self.assertFalse(views.is_course_passed(self.course, None, self.student, self.request)) 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') @attr('shard_1')
class GenerateUserCertTests(ModuleStoreTestCase): class GenerateUserCertTests(ModuleStoreTestCase):
......
...@@ -1302,7 +1302,7 @@ def is_course_passed(course, grade_summary=None, student=None, request=None): ...@@ -1302,7 +1302,7 @@ def is_course_passed(course, grade_summary=None, student=None, request=None):
if grade_summary is None: if grade_summary is None:
grade_summary = grades.grade(student, request, course) 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 @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