Skip to content

Commit

Permalink
fix: renewal processing saves original activation keys
Browse files Browse the repository at this point in the history
We previously were assigning, but not _saving_, the activation key
from original to future licenses when processing renewals.
ENT-9276
  • Loading branch information
iloveagent57 committed Sep 5, 2024
1 parent b9e5b81 commit 5afa00b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion license_manager/apps/subscriptions/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _renew_all_licenses(original_licenses, future_plan, is_auto_renewed):
original_license.renewed_to = future_license
License.bulk_update(
future_licenses,
['status', 'user_email', 'lms_user_id', 'activation_date', 'assigned_date'],
['status', 'user_email', 'lms_user_id', 'activation_key', 'activation_date', 'assigned_date'],
)
License.bulk_update(
original_licenses,
Expand Down
2 changes: 2 additions & 0 deletions license_manager/apps/subscriptions/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def _assert_all_licenses_renewed(self, future_plan):
self.assertEqual(future_license.status, original_license.status)
self.assertEqual(future_license.user_email, original_license.user_email)
self.assertEqual(future_license.lms_user_id, original_license.lms_user_id)
self.assertEqual(future_license.activation_key, original_license.activation_key)
if original_license.status == constants.ACTIVATED:
self.assertEqual(future_license.activation_date, expected_activation_datetime)
self.assertEqual(future_license.assigned_date, NOW)
Expand All @@ -108,6 +109,7 @@ def test_renewal_processed_with_no_existing_future_plan(self):
LicenseFactory.create(
subscription_plan=prior_plan,
status=constants.ASSIGNED,
activation_key=uuid.uuid4(),
user_email='assigned_user_{}@example.com'.format(i)
) for i in range(5)
]
Expand Down

0 comments on commit 5afa00b

Please sign in to comment.