예제 #1
0
 def test_send_assigned_offer_reminder_email(
     self,
     tokens,
     side_effect,
     mock_sailthru_task,
 ):
     """ Test that the offer assignment reminder email message is correctly formatted
      with correct call to the async task in ecommerce-worker.
     """
     email_subject = settings.OFFER_ASSIGNMENT_EMAIL_REMINDER_DEFAULT_SUBJECT
     mock_sailthru_task.delay.side_effect = side_effect
     template = settings.OFFER_ASSIGNMENT_EMAIL_REMINDER_DEFAULT_TEMPLATE
     send_assigned_offer_reminder_email(
         template,
         tokens.get('learner_email'),
         tokens.get('code'),
         tokens.get('redeemed_offer_count'),
         tokens.get('total_offer_count'),
         tokens.get('code_expiration_date'),
     )
     expected_email_body = template.format(
         REDEEMED_OFFER_COUNT=tokens.get('redeemed_offer_count'),
         TOTAL_OFFER_COUNT=tokens.get('total_offer_count'),
         USER_EMAIL=tokens.get('learner_email'),
         CODE=tokens.get('code'),
         EXPIRATION_DATE=tokens.get('code_expiration_date'))
     mock_sailthru_task.delay.assert_called_once_with(
         tokens.get('learner_email'), email_subject, expected_email_body)
예제 #2
0
 def test_send_assigned_offer_reminder_email(
         self,
         greeting,
         closing,
         tokens,
         side_effect,
         mock_sailthru_task,
 ):
     """
     Test that the offer assignment reminder email message is sent to the async task in ecommerce-worker.
     """
     email_subject = settings.OFFER_REMINDER_EMAIL_SUBJECT
     mock_sailthru_task.delay.side_effect = side_effect
     send_assigned_offer_reminder_email(
         greeting,
         closing,
         tokens.get('learner_email'),
         tokens.get('code'),
         tokens.get('redeemed_offer_count'),
         tokens.get('total_offer_count'),
         tokens.get('code_expiration_date'),
     )
     mock_sailthru_task.delay.assert_called_once_with(
         tokens.get('learner_email'),
         email_subject,
         mock.ANY
     )
예제 #3
0
 def test_send_assigned_offer_reminder_email_with_base_url(
     self,
     subject,
     greeting,
     closing,
     sender_alias,
     tokens,
     side_effect,
     mock_sailthru_task,
 ):
     """
     Test that the offer assignment reminder email message is sent to the async task in ecommerce-worker.
     """
     mock_sailthru_task.delay.side_effect = side_effect
     send_assigned_offer_reminder_email(
         subject,
         greeting,
         closing,
         tokens.get('learner_email'),
         tokens.get('code'),
         tokens.get('redeemed_offer_count'),
         tokens.get('total_offer_count'),
         tokens.get('code_expiration_date'),
         sender_alias,
         tokens.get('base_enterprise_url'),
     )
     mock_sailthru_task.delay.assert_called_once_with(
         tokens.get('learner_email'),
         subject,
         mock.ANY,
         sender_alias,
         tokens.get('base_enterprise_url'),
     )
예제 #4
0
 def test_send_assigned_offer_reminder_email(
     self,
     subject,
     greeting,
     closing,
     attachments,
     sender_alias,
     reply_to,
     tokens,
     side_effect,
     mock_email_task,
 ):
     """
     Test that the offer assignment reminder email message is sent to the async task in ecommerce-worker.
     """
     mock_email_task.delay.side_effect = side_effect
     send_assigned_offer_reminder_email(subject,
                                        greeting,
                                        closing,
                                        tokens.get('learner_email'),
                                        tokens.get('code'),
                                        tokens.get('redeemed_offer_count'),
                                        tokens.get('total_offer_count'),
                                        tokens.get('code_expiration_date'),
                                        sender_alias,
                                        reply_to,
                                        attachments=attachments)
     mock_email_task.delay.assert_called_once_with(
         tokens.get('learner_email'),
         subject,
         mock.ANY,
         sender_alias,
         reply_to,
         # base_enterprise_url should be blank as it was not passed in
         base_enterprise_url='',
         attachments=attachments,
     )