Skip to content

Commit

Permalink
refactor(analytics): update claims_provider property name
Browse files Browse the repository at this point in the history
update some variable naming as well
  • Loading branch information
thekaveman committed Oct 1, 2024
1 parent 14369bb commit ed779fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions benefits/oauth/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class OAuthEvent(core.Event):

def __init__(self, request, event_type):
super().__init__(request, event_type)
verifier = session.flow(request)
if verifier and verifier.uses_claims_verification:
self.update_event_properties(auth_provider=verifier.claims_provider.client_name)
flow = session.flow(request)
if flow and flow.uses_claims_verification:
self.update_event_properties(claims_provider=flow.claims_provider.client_name)


class OAuthErrorEvent(OAuthEvent):
Expand Down
6 changes: 3 additions & 3 deletions tests/pytest/oauth/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ def test_OAuthEvent_flow_client_name_when_uses_claims_verification(app_request,

event = OAuthEvent(app_request, "event type")

assert "auth_provider" in event.event_properties
assert event.event_properties["auth_provider"] == mocked_flow.claims_provider.client_name
assert "claims_provider" in event.event_properties
assert event.event_properties["claims_provider"] == mocked_flow.claims_provider.client_name


@pytest.mark.django_db
@pytest.mark.usefixtures("mocked_session_flow_does_not_use_claims_verification")
def test_OAuthEvent_flow_no_client_name_when_does_not_use_claims_verification(app_request):
event = OAuthEvent(app_request, "event type")

assert "auth_provider" not in event.event_properties
assert "claims_provider" not in event.event_properties


@pytest.mark.django_db
Expand Down

0 comments on commit ed779fa

Please sign in to comment.