Esempio n. 1
0
    def test_success_with_optin(self):
        """
        If optin is True, add a Mobile_Subscribers record for the
        number.
        """
        with patch('basket.news.tasks.sfmc') as sfmc_mock:
            add_sms_user('foo', '8675309', True)

            sfmc_mock.add_row.assert_called_with('Mobile_Subscribers', {
                'Phone': '8675309',
                'SubscriberKey': '8675309',
            })
Esempio n. 2
0
    def test_success_with_optin(self):
        """
        If optin is True, add a Mobile_Subscribers record for the
        number.
        """
        with patch('basket.news.tasks.sfmc') as sfmc_mock:
            add_sms_user('foo', '8675309', True)

            sfmc_mock.add_row.assert_called_with('Mobile_Subscribers', {
                'Phone': '8675309',
                'SubscriberKey': '8675309',
            })
Esempio n. 3
0
 def test_success_with_vendor_id(self):
     add_sms_user('foo', '8675309', False, vendor_id='foo')
     self.send_sms.assert_called_with('8675309', 'foo')
     self.get_sms_vendor_id.assert_not_called()
Esempio n. 4
0
 def test_success(self):
     add_sms_user('foo', '8675309', False)
     self.send_sms.assert_called_with('8675309', 'bar')
Esempio n. 5
0
 def test_send_name_invalid(self):
     """If the send_name is invalid, return immediately."""
     self.get_sms_vendor_id.return_value = None
     add_sms_user('baffle', '8675309', False)
     self.send_sms.assert_not_called()
Esempio n. 6
0
 def test_success_with_vendor_id(self):
     add_sms_user('foo', '8675309', False, vendor_id='foo')
     self.send_sms.assert_called_with('8675309', 'foo')
     self.get_sms_vendor_id.assert_not_called()
Esempio n. 7
0
 def test_success(self):
     add_sms_user('foo', '8675309', False)
     self.send_sms.assert_called_with('8675309', 'bar')
Esempio n. 8
0
 def test_send_name_invalid(self):
     """If the send_name is invalid, return immediately."""
     self.get_sms_vendor_id.return_value = None
     add_sms_user('baffle', '8675309', False)
     self.send_sms.assert_not_called()
Esempio n. 9
0
 def test_send_name_invalid(self):
     """If the send_name is invalid, return immediately."""
     add_sms_user('baffle', '8675309', False)
     self.assertFalse(self.send_sms.called)