Skip to content

Commit

Permalink
feat(api-usage): add subscription.plan trait to `flagsmith.get_iden…
Browse files Browse the repository at this point in the history
…tity_flags` (#4247)
  • Loading branch information
matthewelwell authored Jun 26, 2024
1 parent 0354c26 commit 182ea04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api/organisations/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ def handle_api_usage_notifications() -> None:
):
feature_enabled = flagsmith_client.get_identity_flags(
organisation.flagsmith_identifier,
traits={"organisation_id": organisation.id},
traits={
"organisation_id": organisation.id,
"subscription.plan": organisation.subscription.plan,
},
).is_feature_enabled("api_usage_alerting")
if not feature_enabled:
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ def test_handle_api_usage_notifications_when_feature_flag_is_off(
mock_api_usage.assert_not_called()

client_mock.get_identity_flags.assert_called_once_with(
organisation.flagsmith_identifier, traits={"organisation_id": organisation.id}
organisation.flagsmith_identifier,
traits={
"organisation_id": organisation.id,
"subscription.plan": organisation.subscription.plan,
},
)

assert len(mailoutbox) == 0
Expand Down

0 comments on commit 182ea04

Please sign in to comment.