def test_send_new_codes_notification_email_info_log(self): """ Verify that info log message is correct. """ with mock.patch('ecommerce.extensions.api.v2.utils.logger') as mock_logger: send_new_codes_notification_email({}, self.email_address, self.enterprise_id, self.coupon_id) mock_logger.info.assert_called_with( 'New codes email sent to enterprise customer [%s] for coupon [%s]', self.enterprise_id, self.coupon_id )
def test_send_new_codes_notification_email_exception_log(self): """ Verify that exception log message is correct. """ with mock.patch('ecommerce.extensions.api.v2.utils.send_mail', side_effect=SMTPException): with mock.patch('ecommerce.extensions.api.v2.utils.logger') as mock_logger: send_new_codes_notification_email({}, self.email_address, self.enterprise_id, self.coupon_id) mock_logger.exception.assert_called_with( 'New codes email failed for enterprise customer [%s] for coupon [%s]', self.enterprise_id, self.coupon_id )
def send_codes_availability_email(site, email_address, enterprise_id, coupon_id): send_new_codes_notification_email(site, email_address, enterprise_id, coupon_id)