Skip to content

Commit

Permalink
Switch to {app}.{area}.{event} format for analytics events (#8643)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya authored Apr 3, 2024
1 parent b9f99a0 commit a9c10c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion h/schemas/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EventSchema(JSONSchema):
"properties": {
"event": {
"type": "string",
"enum": ["APPLY_PENDING_UPDATES"],
"enum": ["client.realtime.apply_updates"],
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/h/schemas/analytics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestCreateEventSchema:
({"foo": "bar"}, "'event' is a required property"),
(
{"event": "invalid"},
"event: 'invalid' is not one of \\['APPLY_PENDING_UPDATES'\\]",
"event: 'invalid' is not one of \\['client.realtime.apply_updates'\\]",
),
],
)
Expand All @@ -23,6 +23,6 @@ def test_error_for_invalid_data(self, payload: dict, expected_error: str):

def test_valid_data_is_returned(self):
schema = CreateEventSchema()
result = schema.validate({"event": "APPLY_PENDING_UPDATES"})
result = schema.validate({"event": "client.realtime.apply_updates"})

assert result == {"event": "APPLY_PENDING_UPDATES"}
assert result == {"event": "client.realtime.apply_updates"}
2 changes: 1 addition & 1 deletion tests/unit/h/views/api/analytics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@pytest.mark.usefixtures("analytics_service")
class TestCreateEvent:
def test_analytics_service_is_invoked(self, pyramid_request, analytics_service):
pyramid_request.json_body = {"event": "APPLY_PENDING_UPDATES"}
pyramid_request.json_body = {"event": "client.realtime.apply_updates"}
res = create_event(pyramid_request)

assert analytics_service.create.called
Expand Down

0 comments on commit a9c10c1

Please sign in to comment.