Пример #1
0
 def test_dont_check_if_completion_cached(self):
     with patch('edxmarketo.signals.handlers.cached_check_marketo_complete') as dummy_cached_check:
         with patch('edxmarketo.signals.handlers.check_marketo_complete') as dummy_check:
             smodule = self.student_modules['student1_yeslead']['smod_10']
             handlers.handle_check_marketo_completion_score(sender=smodule, module=smodule, grade=smodule.grade, max_grade=smodule.max_grade)
             self.assertEquals(1, dummy_cached_check.call_count)
             self.assertEquals(0, dummy_check.call_count)
Пример #2
0
 def test_check_marketo_complete_if_enabled_for_microsite(self):
     with patch('edxmarketo.signals.handlers.cached_check_marketo_complete') as dummy_cached_check:
         smodule = self.student_modules['student1_yeslead']['smod_2']
         # we can't patch if we send signal, have to call receiver directly
         handlers.handle_check_marketo_completion_score(sender=smodule, module=smodule, grade=smodule.grade, max_grade=smodule.max_grade)
         # course_id, email, course_map
         dummy_cached_check.assert_called_once_with('testorg/101/marketo_test',
                                                    '*****@*****.**',
                                                    COMPLETE_FIELD_MAP)
Пример #3
0
 def test_normal_grade_case_causes_completion(self):
     with patch('edxmarketo.signals.handlers.cached_check_marketo_complete') as dummy_cached_check:
         with patch('edxmarketo.signals.handlers.check_marketo_complete') as dummy_check:
             with patch('edxmarketo.signals.handlers.update_marketo_complete') as dummy_update_marketo_complete:
                 smodule = self.student_modules['student1_yeslead']['smod_4b']
                 handlers.handle_check_marketo_completion_score(sender=smodule, module=smodule, grade=smodule.grade, max_grade=smodule.max_grade)
                 self.assertEquals(1, dummy_cached_check.call_count)
                 self.assertEquals(1, dummy_check.call_count)
                 # we should have a Marketo-complete course... do the update
                 dummy_update_marketo_complete.assert_called_once_with(COMPLETE_FIELD_MAP,
                                                                       'testorg/101/marketo_test',
                                                                       '*****@*****.**')
Пример #4
0
 def test_dont_check_for_completion_if_no_answer_submitted(self):
     # if so, no way it can increase the Marketo complete score
     with patch('edxmarketo.signals.handlers.cached_check_marketo_complete') as dummy_cached_check:
         smodule = self.student_modules['student1_yeslead']['smod_9']
         handlers.handle_check_marketo_completion_score(sender=smodule, module=smodule, grade=smodule.grade, max_grade=smodule.max_grade)
         self.assertEquals(0, dummy_cached_check.call_count)
Пример #5
0
 def test_dont_check_for_completion_if_not_a_problem_module(self):
     with patch('edxmarketo.signals.handlers.cached_check_marketo_complete') as dummy_cached_check:
         smodule = self.student_modules['student1_yeslead']['smod_8']
         handlers.handle_check_marketo_completion_score(sender=smodule, module=smodule, grade=None, max_grade=None)
         self.assertEquals(0, dummy_cached_check.call_count)