Skip to content

Commit

Permalink
fix: personalization on remind
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro committed Oct 6, 2023
1 parent 0ae12f4 commit 12df640
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion license_manager/apps/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
REVOCABLE_LICENSE_STATUSES,
NotificationChoices,
)
from license_manager.apps.subscriptions.event_utils import track_license_changes
from license_manager.apps.subscriptions.event_utils import (
get_license_tracking_properties,
track_license_changes,
)
from license_manager.apps.subscriptions.models import (
CustomerAgreement,
License,
Expand Down Expand Up @@ -222,6 +225,7 @@ def send_reminder_email_task(custom_template_text, email_recipient_list, subscri
'enterprise_contact_email': enterprise_contact_email,
}
recipient = _aliased_recipient_object_from_email(user_email)
recipient['attributes'].update(get_license_tracking_properties(pending_license))

try:
braze_client_instance = BrazeApiClient()
Expand Down
9 changes: 7 additions & 2 deletions license_manager/apps/api/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
UNASSIGNED,
NotificationChoices,
)
from license_manager.apps.subscriptions.event_utils import (
get_license_tracking_properties,
)
from license_manager.apps.subscriptions.exceptions import LicenseRevocationError
from license_manager.apps.subscriptions.models import (
CustomerAgreement,
Expand Down Expand Up @@ -202,9 +205,10 @@ def test_send_reminder_email_task(self, mock_enterprise_client, mock_braze_clien
self.assertNotIn('[email protected]', called_emails)

for user_email in self.email_recipient_list:
expected_license_key = str(self.subscription_plan.licenses.get(
expected_license = self.subscription_plan.licenses.get(
user_email=user_email
).activation_key)
)
expected_license_key = str(expected_license.activation_key)
mock_enterprise_client().get_enterprise_customer_data.assert_any_call(
self.subscription_plan.enterprise_customer_uuid
)
Expand All @@ -229,6 +233,7 @@ def test_send_reminder_email_task(self, mock_enterprise_client, mock_braze_clien
'alias_name': user_email,
},
}
expected_recipient['attributes'].update(get_license_tracking_properties(expected_license))
mock_braze_client().send_campaign_message.assert_any_call(
settings.BRAZE_ASSIGNMENT_EMAIL_CAMPAIGN,
recipients=[expected_recipient],
Expand Down

0 comments on commit 12df640

Please sign in to comment.