def test_default_confirm_notice_H(self, send_message): """Test newsletter that has no explicit confirm""" send_confirm_notice(self.email, self.token, "en", "H", ['slug2']) expected_message = mogrify_message_id(CONFIRMATION_MESSAGE, 'en', 'H') send_message.delay.assert_called_with(expected_message, self.email, self.token, 'H')
def test_default_confirm_notice_short_for_long(self, send_message): """Test using short form of lang that's in the newsletter list as a long lang""" send_confirm_notice(self.email, self.token, "rr", "H", ['slug2']) expected_message = mogrify_message_id(CONFIRMATION_MESSAGE, 'rr', 'H') send_message.delay.assert_called_with(expected_message, self.email, self.token, 'H')
def test_explicit_confirm_notice_long_lang_T(self, send_message): """Test newsletter that has explicit confirm message with long lang""" send_confirm_notice(self.email, self.token, "en-US", "T", ['slug1']) expected_message = 'en_confirm1_T' send_message.delay.assert_called_with(expected_message, self.email, self.token, 'T')
def test_default_confirm_notice_long_lang_T(self, send_message): """Test newsletter that has no explicit confirm with long lang code""" send_confirm_notice(self.email, self.token, "es-ES", "T", ['slug2']) expected_message = mogrify_message_id(CONFIRMATION_MESSAGE, 'es', 'T') send_message.delay.assert_called_with(expected_message, self.email, self.token, 'T')
def test_explicit_confirm_notice_H(self, send_message): """Test newsletter that has explicit confirm message""" send_confirm_notice(self.email, self.token, "en", "H", ['slug1']) expected_message = 'en_confirm1' send_message.delay.assert_called_with(expected_message, self.email, self.token, 'H')
def test_explicit_confirm_notice_bad_lang_H(self, send_message): """Test when newsletter uses explicit notice and the lang is unknown""" send_confirm_notice(self.email, self.token, "zz", "H", ['slug1']) send_confirm_notice(self.email, self.token, "zz-Z", "H", ['slug1']) self.assertFalse(send_message.called)
def test_explicit_confirm_notice_T(self, send_message): """Test newsletter that has explicit confirm message""" send_confirm_notice(self.email, self.token, "en", "T", ['slug1']) expected_message = 'en_confirm1_T' send_message.assert_called_with(expected_message, self.email, self.token, 'T')
def test_default_confirm_notice_bad_lang_H(self, send_message): """Test when there's no default confirm notice for a language""" with self.assertRaises(BasketError): send_confirm_notice(self.email, self.token, "fr", "H", ['slug2']) with self.assertRaises(BasketError): send_confirm_notice(self.email, self.token, "zz-Z", "H", ['slug2'])
def test_default_confirm_notice_bad_lang_T(self, send_message): """Test when newsletter uses default notice and the lang is unknown""" send_confirm_notice(self.email, self.token, "fr", "T", ['slug2']) send_confirm_notice(self.email, self.token, "zz-Z", "T", ['slug2']) self.assertFalse(send_message.called)
def test_default_confirm_notice_long_lang_T(self, send_message): """Test newsletter that has no explicit confirm with long lang code""" send_confirm_notice(self.email, self.token, "es-ES", "T", ['slug2']) expected_message = mogrify_message_id(CONFIRMATION_MESSAGE, 'es', 'T') send_message.assert_called_with(expected_message, self.email, self.token, 'T')
def test_default_confirm_notice_short_for_long(self, send_message): """Test using short form of lang that's in the newsletter list as a long lang""" send_confirm_notice(self.email, self.token, "rr", "H", ['slug2']) expected_message = mogrify_message_id(CONFIRMATION_MESSAGE, 'rr', 'H') send_message.assert_called_with(expected_message, self.email, self.token, 'H')
def test_default_confirm_notice_H(self, send_message): """Test newsletter that has no explicit confirm""" send_confirm_notice(self.email, self.token, "en", "H", ['slug2']) expected_message = mogrify_message_id(CONFIRMATION_MESSAGE, 'en', 'H') send_message.assert_called_with(expected_message, self.email, self.token, 'H')
def test_explicit_confirm_notice_bad_lang_H(self, send_message): """Test when newsletter uses explicit notice and the lang is unknown""" with self.assertRaises(BasketError): send_confirm_notice(self.email, self.token, "zz", "H", ['slug1']) with self.assertRaises(BasketError): send_confirm_notice(self.email, self.token, "zz-Z", "H", ['slug1'])
def test_explicit_confirm_notice_long_lang_H(self, send_message): """Test newsletter that has explicit confirm message with long lang""" send_confirm_notice(self.email, self.token, "en-US", "H", ['slug1']) expected_message = 'en_confirm1' send_message.assert_called_with(expected_message, self.email, self.token, 'H')
def test_default_confirm_notice_bad_lang_T(self, send_message): """Test when newsletter uses default notice and the lang is unknown""" with self.assertRaises(BasketError): send_confirm_notice(self.email, self.token, "fr", "T", ['slug2']) with self.assertRaises(BasketError): send_confirm_notice(self.email, self.token, "zz-Z", "T", ['slug2'])
def test_default_confirm_notice_bad_lang_H(self, send_message): """Test when there's no default confirm notice for a language""" send_confirm_notice(self.email, self.token, "fr", "H", ['slug2']) send_confirm_notice(self.email, self.token, "zz-Z", "H", ['slug2']) self.assertFalse(send_message.called)