Skip to content

Commit

Permalink
Avoid the use of getattr.
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed Nov 23, 2015
1 parent fdb454a commit 58348fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vumi/components/tests/test_message_store.py
Expand Up @@ -113,8 +113,11 @@ def create_outbound_messages(self, batch_id, count, start_timestamp=None,
returnValue(messages)

def _create_event(self, event_type, timestamp):
assert event_type in ('ack', 'nack', 'delivery_report')
maker = getattr(self.msg_helper, 'make_%s' % (event_type,))
maker = {
'ack': self.msg_helper.make_ack,
'nack': self.msg_helper.make_nack,
'delivery_report': self.msg_helper.make_delivery_report,
}[event_type]
return maker(timestamp=timestamp)

@inlineCallbacks
Expand Down

0 comments on commit 58348fd

Please sign in to comment.