Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: personalization on remind #532

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading