Esempio n. 1
0
 def test_purchase_is_not_invoked(self, mock_sailthru_purchase, switch):
     """Make sure purchase is not called in the following condition:
         i: waffle switch is True and mode is verified
     """
     switch.return_value = True
     update_sailthru(None, None, self.user, 'verified', self.course_id)
     self.assertFalse(mock_sailthru_purchase.called)
Esempio n. 2
0
 def test_purchase_is_not_invoked(self, mock_sailthru_purchase, switch):
     """Make sure purchase is not called in the following condition:
         i: waffle switch is True and mode is verified
     """
     switch.return_value = True
     update_sailthru(None, None, self.user, 'verified', self.course_id)
     self.assertFalse(mock_sailthru_purchase.called)
Esempio n. 3
0
 def test_encoding_is_working_for_email_contains_unicode(self, mock_sailthru_purchase, switch):
     """Make sure encoding is working for emails contains unicode characters
     while sending it to sail through.
     """
     switch.return_value = True
     self.user.email = u'tè[email protected]'
     update_sailthru(None, self.user, 'audit', self.course_id)
     self.assertTrue(mock_sailthru_purchase.called)
Esempio n. 4
0
 def test_update_course_enrollment_whitelabel(
         self,
         switch,
         mock_sailthru_api_post,
         mock_sailthru_api_get,
         mock_sailthru_purchase
 ):
     """test user record not sent to sailthru when enrolled in a course at white label site"""
     switch.return_value = True
     white_label_site = Site.objects.create(domain='testwhitelabel.com', name='White Label')
     site_dict = {'id': white_label_site.id, 'domain': white_label_site.domain, 'name': white_label_site.name}
     with patch('email_marketing.signals._get_current_site') as mock_site_info:
         mock_site_info.return_value = site_dict
         update_sailthru(None, self.user, 'audit', self.course_id)
         self.assertFalse(mock_sailthru_purchase.called)
         self.assertFalse(mock_sailthru_api_post.called)
         self.assertFalse(mock_sailthru_api_get.called)
Esempio n. 5
0
 def test_update_course_enrollment_whitelabel(
         self,
         switch,
         mock_sailthru_api_post,
         mock_sailthru_api_get,
         mock_sailthru_purchase
 ):
     """test user record not sent to sailthru when enrolled in a course at white label site"""
     switch.return_value = True
     white_label_site = Site.objects.create(domain='testwhitelabel.com', name='White Label')
     site_dict = {'id': white_label_site.id, 'domain': white_label_site.domain, 'name': white_label_site.name}
     with patch('email_marketing.signals._get_current_site') as mock_site_info:
         mock_site_info.return_value = site_dict
         update_sailthru(None, self.user, 'audit', self.course_id)
         self.assertFalse(mock_sailthru_purchase.called)
         self.assertFalse(mock_sailthru_api_post.called)
         self.assertFalse(mock_sailthru_api_get.called)
Esempio n. 6
0
 def test_switch_is_disabled(self, mock_sailthru_purchase):
     """Make sure sailthru purchase is not called when waffle switch is disabled"""
     update_sailthru(None, None, self.user, 'verified', self.course_id)
     self.assertFalse(mock_sailthru_purchase.called)
Esempio n. 7
0
 def test_switch_is_disabled(self, mock_sailthru_purchase):
     """Make sure sailthru purchase is not called when waffle switch is disabled"""
     update_sailthru(None, None, self.user, 'verified', self.course_id)
     self.assertFalse(mock_sailthru_purchase.called)