def test_mk_inbound_push_trigger(self): conv = yield self.app_helper.create_conversation() msg = mk_inbound_push_trigger("to-addr-1", conv) self.assertEqual(msg[INBOUND_PUSH_TRIGGER], True) self.assertEqual(msg["content"], None) self.assertEqual(msg["transport_name"], None) self.assertEqual(msg["transport_type"], None) self.assertEqual(msg["from_addr"], "to-addr-1") self.assertEqual(msg["to_addr"], None) self.assertEqual( msg["helper_metadata"], { 'go': { 'conversation_key': conv.key, 'conversation_type': u'dummy', 'user_account': u'test-0-user', }, })
def test_mk_inbound_push_trigger(self): conv = yield self.app_helper.create_conversation() msg = mk_inbound_push_trigger( "to-addr-1", conv) self.assertEqual(msg[INBOUND_PUSH_TRIGGER], True) self.assertEqual(msg["content"], None) self.assertEqual(msg["transport_name"], None) self.assertEqual(msg["transport_type"], None) self.assertEqual(msg["from_addr"], "to-addr-1") self.assertEqual(msg["to_addr"], None) self.assertEqual(msg["helper_metadata"], { 'go': { 'conversation_key': conv.key, 'conversation_type': u'dummy', 'user_account': u'test-0-user', }, })
def make_push_trigger(self, to_addr, conv): msg = mk_inbound_push_trigger(to_addr, conv) self.app_worker.add_inbound_message(msg) return msg
def send_inbound_push_trigger(self, to_addr, conversation): self.emit('Starting %r [%s] -> %s' % ( conversation.name, conversation.key, to_addr)) msg = mk_inbound_push_trigger(to_addr, conversation) return self.send_to_conv(conversation, msg)
def send_inbound_push_trigger(self, to_addr, conversation): log.debug('Starting %r -> %s' % (conversation, to_addr)) msg = mk_inbound_push_trigger(to_addr, conversation) return self.consume_user_message(msg)
def send_inbound_push_trigger(self, to_addr, conversation): self.emit('Starting %r [%s] -> %s' % (conversation.name, conversation.key, to_addr)) msg = mk_inbound_push_trigger(to_addr, conversation) return self.send_to_conv(conversation, msg)