Skip to content

Commit

Permalink
Add @iopipe/event-info.eventType for all key events (#263)
Browse files Browse the repository at this point in the history
Closes #262
  • Loading branch information
kolanos authored Sep 25, 2018
1 parent ed3c22c commit a6120ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion iopipe/contrib/eventinfo/event_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ def has_required_keys(self):

def collect(self):
if self.keys == "all":
return collect_all_keys(
event_info = collect_all_keys(
self.event, "@iopipe/event-info.%s" % self.type, self.exclude_keys
)
event_info["@iopipe/event-info.eventType"] = self.type
return event_info

event_info = {}
for key in self.keys:
if isinstance(key, tuple):
Expand Down
9 changes: 6 additions & 3 deletions tests/contrib/eventinfo/test_event_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ def test__event_types__alexa_skill(event_alexa_skill):
assert event.has_required_keys() is True

event_info = event.collect()
assert event_info != {}
assert all([k.startswith("@iopipe/event-info.alexaSkill.") for k in event_info])
assert len(list(event_info.keys())) == 31
expected_keys = ["@iopipe/event-info.eventType"] + [
"@iopipe/event-info.alexaSkill.%s" % key for key in event.keys
]
assert list(event_info.keys()).sort() == expected_keys.sort()

assert len(list(event_info.keys())) == 32


def test__event_types__apigw(event_apigw):
Expand Down

0 comments on commit a6120ff

Please sign in to comment.