Skip to content

Commit

Permalink
Sort the event tag keys as they were being returned in an undetermini…
Browse files Browse the repository at this point in the history
…stic way, which made some unit tests inconsistent. Event tag keys is a short list, so the sort should not create overhead.
  • Loading branch information
alda-optimizely committed Sep 8, 2017
1 parent 7327b0a commit a552d40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion optimizely/event_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _add_required_params_for_conversion(self, event_key, event_tags, decisions):

self.params[self.EventParams.EVENT_METRICS] = event_values

for event_tag_id in event_tags.keys():
for event_tag_id in sorted(event_tags.keys()):
event_tag_value = event_tags.get(event_tag_id)
if event_tag_value is None:
continue
Expand Down
8 changes: 4 additions & 4 deletions tests/test_optimizely.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,14 +743,14 @@ def test_track__with_invalid_event_tags(self):
'eventEntityId': '111095',
'eventName': 'test_event',
'eventFeatures': [{
'name': 'value',
'name': 'revenue',
'type': 'custom',
'value': '1.234',
'value': '4200',
'shouldIndex': False,
}, {
'name': 'revenue',
'name': 'value',
'type': 'custom',
'value': '4200',
'value': '1.234',
'shouldIndex': False,
}],
'eventMetrics': [],
Expand Down

0 comments on commit a552d40

Please sign in to comment.