Skip to content

Commit

Permalink
Merge pull request #167 from praekelt/feature/MOMZA-836-create-messag…
Browse files Browse the repository at this point in the history
…e-endpoints

Save event on destination
  • Loading branch information
erikh360 committed Jan 18, 2018
2 parents b7130a6 + 6870f08 commit 0070ae2
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions junebug/tests/test_from_address_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,45 @@ def test_inbound_event_routing(self):
connector_name='testqueue3')
self.assertEqual(ack, event)

@inlineCallbacks
def test_inbound_event_store(self):
"""
Inbound events should be stored to the correct destinations
"""
worker = yield self.get_router_worker({
'destinations': [{
'id': "test-destination1",
'amqp_queue': "testqueue1",
'config': {'regular_expression': '^1.*$'},
}, {
'id': "test-destination2",
'amqp_queue': "testqueue2",
'config': {'regular_expression': '^2.*$'},
}, {
'id': "test-destination3",
'amqp_queue': "testqueue3",
'config': {'regular_expression': '^2.*$'},
}],
'channel': '41e58f4a-2acc-442f-b3e5-3cf2b2f1cf14',
})

message_worker = worker.namedServices['test-destination2']

outbound = self.messagehelper.make_outbound(
"test message", from_addr="2234")
yield self.workerhelper.dispatch_outbound(outbound, 'testqueue2')
ack = self.messagehelper.make_ack(outbound)
yield self.workerhelper.dispatch_event(
ack, '41e58f4a-2acc-442f-b3e5-3cf2b2f1cf14')

[event] = yield self.workerhelper.wait_for_dispatched_events(
connector_name='testqueue2')

[stored_event] = yield message_worker.outbounds.load_all_events(
"test-destination2", outbound["message_id"])

self.assertEqual(event, stored_event)

@inlineCallbacks
def test_inbound_event_routing_no_inbound_message(self):
"""
Expand Down

0 comments on commit 0070ae2

Please sign in to comment.