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

Commit

Permalink
Explicit (basic) test for bulk send command.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerith committed Feb 9, 2015
1 parent 80c0b43 commit 3ac4939
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions go/apps/bulk_message/tests/test_vumi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,36 @@ def test_consume_events(self):
self.assertEqual(
(yield self.app.window_manager.count_in_flight(window_id)), 0)

@inlineCallbacks
def test_bulk_send_command(self):
"""
If we send a bulk message to a number of contacts, we send a message to
the msisdn for each contact.
"""
group = yield self.app_helper.create_group_with_contacts(u'group', 10)
conversation = yield self.app_helper.create_conversation(
groups=[group])
yield self.app_helper.start_conversation(conversation)
batch_id = conversation.batch.key
yield self.app_helper.dispatch_command(
"bulk_send",
user_account_key=conversation.user_account.key,
conversation_key=conversation.key,
batch_id=batch_id,
dedupe=False,
content="hello world",
delivery_class="sms",
msg_options={},
)
yield self.app_helper.kick_delivery()
self.clock.advance(self.app.monitor_interval + 1)

contacts = yield self.get_opted_in_contacts(conversation)
msgs = yield self.app_helper.wait_for_dispatched_outbound(10)
contact_addrs = sorted([contact.msisdn for contact in contacts])
msg_addrs = sorted([msg["to_addr"] for msg in msgs])
self.assertEqual(contact_addrs, msg_addrs)

@inlineCallbacks
def test_send_message_command(self):
msg_options = {
Expand Down

0 comments on commit 3ac4939

Please sign in to comment.