def test_on_start_success(self):
        """Test happy path of on_start."""
        mock_event = unittest.mock.MagicMock()

        self.handler.on_start(mock_event)

        mock_event.container.create_sender.assert_called_once_with(
            proton.Url(TEST_QUEUE_HOST,
                       username=TEST_QUEUE_USERNAME,
                       password=TEST_QUEUE_PASSWORD))
コード例 #2
0
    def __init__(self, opts, reactor_opts=None):
        """
        CoreClient constructor

        :param opts: core client options
        :type opts: optparse.Values instance
        :param reactor_opts: reactor options
        :type reactor_opts: dict
        """
        reactor_opts = reactor_opts or {}
        super(CoreClient, self).__init__(**reactor_opts)
        self.url = proton.Url(opts.broker_url)
        self.msg_total_cnt = None
        self.start_tm = time.time()
        self.opts = opts
        if getattr(opts, 'sync_mode', None) or getattr(opts, 'capacity', None):
            raise NotImplementedError(
                "Options not implemented yet: 'sync_mode', 'capacity'")
        self.auto_settle = reactor_opts.get('auto_settle', True)
        self.timeout = None
        self.next_task = None
        self.tearing_down = False
        self.msgs = []