Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Ignore event cache when comparing events.
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed May 20, 2015
1 parent d4de093 commit fc7d67f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions go/vumitools/tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,15 @@ def assert_unroutable_reply(self, connector_name, msg,
[reply] = self.get_dispatched_outbound(connector_name)
self.assert_reply_matches(reply, msg, reply_content, **md)

def assert_events_equal(self, events1, events2, clear_caches=True):
""" Assert that lists of events are equal, clearing the message
cache of each event first if requested.
"""
if clear_caches:
for ev in events1 + events2:
ev.cache.clear()
self.assertEqual(events1, events2)

@inlineCallbacks
def mk_msg_reply(self, **kw):
"Create and store an outbound message, then create a reply for it."
Expand Down Expand Up @@ -697,7 +706,7 @@ def test_event_routing_to_app1(self):
['TRANSPORT_TAG:pool1:1234', 'default'],
['CONVERSATION:app1:conv1', 'default'],
], outbound_hops_from=msg)
self.assertEqual([ack], self.get_dispatched_events('app1'))
self.assert_events_equal([ack], self.get_dispatched_events('app1'))

@inlineCallbacks
def test_event_routing_to_app2(self):
Expand All @@ -715,7 +724,7 @@ def test_event_routing_to_app2(self):
['TRANSPORT_TAG:pool1:9012', 'default'],
['CONVERSATION:app2:conv2', 'default'],
], outbound_hops_from=msg)
self.assertEqual([ack], self.get_dispatched_events('app2'))
self.assert_events_equal([ack], self.get_dispatched_events('app2'))

@inlineCallbacks
def test_event_routing_via_custom_endpoint(self):
Expand All @@ -735,7 +744,7 @@ def test_event_routing_via_custom_endpoint(self):
['TRANSPORT_TAG:pool1:5678', 'default'],
['CONVERSATION:app1:conv1', 'other']
], outbound_hops_from=msg)
self.assertEqual([ack], self.get_dispatched_events('app1'))
self.assert_events_equal([ack], self.get_dispatched_events('app1'))

@inlineCallbacks
def test_event_whose_outbound_has_hops_but_no_user_account(self):
Expand Down Expand Up @@ -1089,7 +1098,7 @@ def test_event_routing_to_app1(self):
['CONVERSATION:app1:conv1', 'default'],
], outbound_hops_from=msg)

self.assertEqual([ack], self.get_dispatched_events('app1'))
self.assert_events_equal([ack], self.get_dispatched_events('app1'))

@inlineCallbacks
def test_unroutable_inbound_reply_via_billing(self):
Expand Down Expand Up @@ -1352,7 +1361,7 @@ def test_event_for_unroutable_inbound_reply_on_first_hop(self):
['TRANSPORT_TAG:pool1:1234', 'default'],
['ROUTER:router:router1:INBOUND', 'other'],
])
self.assertEqual(expected, event)
self.assert_events_equal([expected], [event])

@inlineCallbacks
def test_event_for_unroutable_inbound_reply_on_last_hop(self):
Expand Down

0 comments on commit fc7d67f

Please sign in to comment.