Commit 62ea4865 by arbisoft

ECOM-528 updated the test cases

parent 50961fe5
......@@ -129,42 +129,24 @@ class TestRecentEnrollments(ModuleStoreTestCase):
@ddt.data(
#Register as an honor in any course modes with no payment option
([('audit', 0), ('honor', 0)], 'honor', True),
([('audit', 0)], 'honor', True),
([('honor', 0)], 'honor', True),
([], 'honor', True),
#Register as an honor in any course modes which has payment option
([('audit', 0), ('honor', 10)], 'honor', False),
([('audit', 10), ('honor', 0)], 'honor', False),
([('professional', 20)], 'honor', True),
([('verified', 20)], 'honor', True),
([('professional', 20), ('verified', 20)], 'honor', True),
([('audit', 0), ('honor', 5), ('professional', 20)], 'honor', True),
([('audit', 0), ('honor', 10), ('verified', 20)], 'honor', True),
([('audit', 10), ('honor', 0), ('verified', 20), ('professional', 20)], 'honor', True),
([('audit', 10)], 'honor', False),
([('honor', 10)], 'honor', False),
([('honor', 10)], 'honor', False), # This is a paid course
([('audit', 0), ('honor', 0), ('professional', 20)], 'honor', True),
([('audit', 0), ('honor', 0), ('verified', 20)], 'honor', True),
([('audit', 0), ('honor', 0), ('verified', 20), ('professional', 20)], 'honor', True),
([], 'honor', True),
#Register as an audit in any course modes with no payment option
([('audit', 0), ('honor', 0)], 'audit', True),
([('audit', 0)], 'audit', True),
([('honor', 0)], 'audit', True),
([], 'audit', True),
#Register as an audit in any course modes which has payment option
([('audit', 0), ('honor', 10)], 'audit', False),
([('audit', 10), ('honor', 0)], 'audit', False),
([('audit', 10)], 'audit', False),
([('honor', 10)], 'audit', False),
([], 'audit', True),
#Register as an audit in any course modes which has no payment option
([('audit', 0), ('honor', 0), ('verified', 10)], 'audit', True),
#Register as a verified in any course modes which has payment option
([('audit', 0), ('honor', 10)], 'verified', False),
([('professional', 20)], 'verified', False),
([('professional', 20)], 'professional', False),
([('verified', 20)], 'verified', False),
([('professional', 20), ('verified', 20)], 'verified', False),
([('audit', 0), ('honor', 5), ('professional', 20)], 'verified', False),
([('audit', 0), ('honor', 10), ('verified', 20)], 'verified', False),
([('audit', 0), ('honor', 10), ('verified', 20), ('professional', 20)], 'verified', False),
([('audit', 10)], 'verified', False),
([('honor', 10)], 'verified', False),
([('audit', 0), ('honor', 0), ('verified', 20)], 'verified', False)
)
@ddt.unpack
def test_donate_button(self, course_modes, enrollment_mode, show_donate):
......
......@@ -760,8 +760,7 @@ def _allow_donation(course_modes, course_id, enrollment):
"""
donations_enabled = DonationConfiguration.current().enabled
return donations_enabled and enrollment.mode in course_modes[course_id] and \
course_modes[course_id][enrollment.mode].min_price == 0
return donations_enabled and enrollment.mode in course_modes[course_id] and course_modes[course_id][enrollment.mode].min_price == 0
def try_change_enrollment(request):
......
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