Пример #1
0
 def test_lang_not_available(self, mock_look_for_user, mock_send):
     """Language not available for recover message"""
     # Should trigger message in english if not available in user lang
     format = 'T'
     mock_look_for_user.return_value = {
         'id': 'SFDCID',
         'status': 'ok',
         'email': self.email,
         'format': format,
         'country': '',
         'lang': 'fr',
         'token': 'USERTOKEN',
         'newsletters': [],
     }
     send_recovery_message_task(self.email)
     message_id = mogrify_message_id(RECOVERY_MESSAGE_ID, 'en', format)
     mock_send.delay.assert_called_with(message_id, self.email, 'SFDCID',
                                        token='USERTOKEN')
Пример #2
0
 def test_email_in_et(self, mock_look_for_user, mock_send):
     """Email not in basket but in ET"""
     # Should trigger message. We can follow the user's format and lang pref
     format = 'T'
     lang = 'fr'
     mock_look_for_user.return_value = {
         'id': 'SFDCID',
         'status': 'ok',
         'email': self.email,
         'format': format,
         'country': '',
         'lang': lang,
         'token': 'USERTOKEN',
         'newsletters': [],
     }
     send_recovery_message_task(self.email)
     message_id = mogrify_message_id(RECOVERY_MESSAGE_ID, lang, format)
     mock_send.delay.assert_called_with(message_id, self.email, 'SFDCID',
                                        token='USERTOKEN')
Пример #3
0
 def test_lang_not_available(self, mock_look_for_user, mock_send):
     """Language not available for recover message"""
     # Should trigger message in english if not available in user lang
     format = 'T'
     mock_look_for_user.return_value = {
         'id': 'SFDCID',
         'status': 'ok',
         'email': self.email,
         'format': format,
         'country': '',
         'lang': 'fr',
         'token': 'USERTOKEN',
         'newsletters': [],
     }
     send_recovery_message_task(self.email)
     message_id = mogrify_message_id(RECOVERY_MESSAGE_ID, 'en', format)
     mock_send.delay.assert_called_with(message_id,
                                        self.email,
                                        'SFDCID',
                                        token='USERTOKEN')
Пример #4
0
 def test_email_in_et(self, mock_look_for_user, mock_send):
     """Email not in basket but in ET"""
     # Should trigger message. We can follow the user's format and lang pref
     format = 'T'
     lang = 'fr'
     mock_look_for_user.return_value = {
         'id': 'SFDCID',
         'status': 'ok',
         'email': self.email,
         'format': format,
         'country': '',
         'lang': lang,
         'token': 'USERTOKEN',
         'newsletters': [],
     }
     send_recovery_message_task(self.email)
     message_id = mogrify_message_id(RECOVERY_MESSAGE_ID, lang, format)
     mock_send.delay.assert_called_with(message_id,
                                        self.email,
                                        'SFDCID',
                                        token='USERTOKEN')
Пример #5
0
 def test_mogrify_message_id_upcase_lang(self):
     """Test adding uppercase lang and format to message ID"""
     result = mogrify_message_id("MESSAGE", "FR", "T")
     expect = "fr_MESSAGE_T"
     self.assertEqual(expect, result)
Пример #6
0
 def test_mogrify_message_id_no_lang(self):
     """Test adding no lang and format to message ID"""
     result = mogrify_message_id("MESSAGE", None, "T")
     expect = "MESSAGE_T"
     self.assertEqual(expect, result)
Пример #7
0
 def test_mogrify_message_id_long_lang(self):
     """Test adding long lang and format to message ID"""
     result = mogrify_message_id("MESSAGE", "en-US", "T")
     expect = "en_MESSAGE_T"
     self.assertEqual(expect, result)
Пример #8
0
 def test_mogrify_message_id_html(self):
     """Test adding lang and html format to message ID"""
     result = mogrify_message_id("MESSAGE", "en", "H")
     expect = "en_MESSAGE"
     self.assertEqual(expect, result)
Пример #9
0
 def test_mogrify_message_id_upcase_lang(self):
     """Test adding uppercase lang and format to message ID"""
     result = mogrify_message_id("MESSAGE", "FR", "T")
     expect = "fr_MESSAGE_T"
     self.assertEqual(expect, result)
Пример #10
0
 def test_mogrify_message_id_long_lang(self):
     """Test adding long lang and format to message ID"""
     result = mogrify_message_id("MESSAGE", "en-US", "T")
     expect = "en_MESSAGE_T"
     self.assertEqual(expect, result)
Пример #11
0
 def test_mogrify_message_id_no_lang(self):
     """Test adding no lang and format to message ID"""
     result = mogrify_message_id("MESSAGE", None, "T")
     expect = "MESSAGE_T"
     self.assertEqual(expect, result)
Пример #12
0
 def test_mogrify_message_id_html(self):
     """Test adding lang and html format to message ID"""
     result = mogrify_message_id("MESSAGE", "en", "H")
     expect = "en_MESSAGE"
     self.assertEqual(expect, result)