示例#1
0
 def __init__(self, worker):
     self.options = worker.options
     self.config = worker.config
     self.spec = get_spec(vumi_resource_path(worker.options['specfile']))
     self.delegate = TwistedDelegate()
     self.worker = worker
     self.amqp_client = None
示例#2
0
 def get_message_sender(self):
     '''Creates a new MessageSender object, with a fake amqp client'''
     message_sender = MessageSender('amqp-spec-0-8.xml', None)
     spec = get_spec(vumi_resource_path('amqp-spec-0-8.xml'))
     client = FakeAmqpClient(spec)
     message_sender.client = client
     return message_sender
示例#3
0
 def __init__(self, worker):
     self.options = worker.options
     self.config = worker.config
     self.spec = get_spec(vumi_resource_path(worker.options['specfile']))
     self.delegate = TwistedDelegate()
     self.worker = worker
     self.amqp_client = None
示例#4
0
 def get_message_sender(self):
     '''Creates a new MessageSender object, with a fake amqp client'''
     message_sender = MessageSender('amqp-spec-0-8.xml', None)
     spec = get_spec(vumi_resource_path('amqp-spec-0-8.xml'))
     client = FakeAmqpClient(spec)
     message_sender.client = client
     return message_sender
示例#5
0
    def get_worker(self, **config):
        spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
        amq_client = fake_amqp.FakeAMQClient(spec, {}, self.broker)

        worker = TestWorker({}, config)
        worker._amqp_client = amq_client
        yield worker.startWorker()
        returnValue(worker)
示例#6
0
    def get_worker(self, **config):
        spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
        amq_client = fake_amqp.FakeAMQClient(spec, {}, self.broker)

        worker = TestWorker({}, config)
        worker._amqp_client = amq_client
        yield worker.startWorker()
        returnValue(worker)
示例#7
0
 def __init__(
         self, specfile, amqp_config, connected_callback,
         disconnected_callback):
     '''Factory that creates JunebugAMQClients.
     specfile - string of specfile name
     amqp_config - connection details for amqp server
     '''
     self.connected_callback, self.disconnected_callback = (
         connected_callback, disconnected_callback)
     self.amqp_config = amqp_config
     self.spec = get_spec(vumi_resource_path(specfile))
     self.delegate = TwistedDelegate()
     super(AmqpFactory, self).__init__()
示例#8
0
 def test_make_campaign_path_abs(self):
     vumi_tests_path = os.path.dirname(__file__)
     vumi_path = os.path.dirname(os.path.dirname(vumi_tests_path))
     self.assertEqual('/foo/bar', vumi_resource_path('/foo/bar'))
     self.assertEqual(os.path.join(vumi_path, 'vumi/resources/foo/bar'),
                      vumi_resource_path('foo/bar'))
示例#9
0
文件: utils.py 项目: AndrewCvekl/vumi
def get_fake_amq_client(broker=None):
    spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
    return FakeAMQClient(spec, {}, broker)
示例#10
0
 def _connect(self, worker, timeout, bindAddress):
     spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
     amq_client = FakeAMQClient(spec, self.options, self.broker)
     self.broker = amq_client.broker  # So we use the same broker for all.
     reactor.callLater(0, worker._amqp_connected, amq_client)
示例#11
0
文件: utils.py 项目: Erict19/vumi
def get_stubbed_worker(worker_class, config=None, broker=None):
    spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
    amq_client = FakeAMQClient(spec, {}, broker)
    worker = worker_class({}, config)
    worker._amqp_client = amq_client
    return worker
示例#12
0
def get_stubbed_channel(broker=None, id=0):
    spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
    amq_client = FakeAMQClient(spec, {}, broker)
    return amq_client.channel(id)
示例#13
0
 def test_make_campaign_path_abs(self):
     vumi_tests_path = os.path.dirname(__file__)
     vumi_path = os.path.dirname(os.path.dirname(vumi_tests_path))
     self.assertEqual('/foo/bar', vumi_resource_path('/foo/bar'))
     self.assertEqual(os.path.join(vumi_path, 'vumi/resources/foo/bar'),
                      vumi_resource_path('foo/bar'))
示例#14
0
文件: utils.py 项目: Erict19/vumi
 def _connect(self, worker, timeout, bindAddress):
     spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
     amq_client = FakeAMQClient(spec, self.options, self.broker)
     self.broker = amq_client.broker  # So we use the same broker for all.
     reactor.callLater(0, worker._amqp_connected, amq_client)
示例#15
0
def get_fake_amq_client(broker=None):
    spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
    return FakeAMQClient(spec, {}, broker)
示例#16
0
def get_stubbed_worker(worker_class, config=None, broker=None):
    spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
    amq_client = FakeAMQClient(spec, {}, broker)
    worker = worker_class({}, config)
    worker._amqp_client = amq_client
    return worker
示例#17
0
文件: utils.py 项目: Nagato23/vumi
def get_stubbed_channel(broker=None, id=0):
    spec = get_spec(vumi_resource_path("amqp-spec-0-8.xml"))
    amq_client = FakeAMQClient(spec, {}, broker)
    return amq_client.channel(id)