Esempio n. 1
0
 def reply_to_engine(self):
     """
     When the job is complete the workitem is passed back to the
     ruote engine.  The consume() method should set the
     workitem.result() if required.
     """
     send(self._chan, self.workitem)
 def test_send(self):
     class ChannelStub:
         def basic_publish(self, msg, exchange, routing_key):
             self.msg = msg
             self.exchange = exchange
             self.routing_key = routing_key 
     channel = ChannelStub()
     send(channel, Workitem(json.dumps(self.all_dict)))
     msg = channel.msg
     self.assertEquals(self.all_dict, json.loads(msg.body))
     self.assertEquals('', channel.exchange)
     self.assertEquals(WORKITEM_ROUTING_KEY, channel.routing_key)