Пример #1
0
    def setUp(self):
        confdata = six.StringIO("""[broker]
urls = amqps://broker1.example.com:5671 amqps://broker2.example.com:5671
cert = /etc/koji-hub/plugins/client.pem
cacert = /etc/koji-hub/plugins/ca.pem
topic_prefix = koji
connect_timeout = 10
send_timeout = 60
""")
        conf = SafeConfigParser()
        conf.readfp(confdata)
        self.handler = protonmsg.TimeoutHandler(
            'amqps://broker1.example.com:5671', [], conf)
Пример #2
0
    def test_on_start_no_ssl(self, SSLDomain):
        confdata = six.StringIO("""[broker]
urls = amqp://broker1.example.com:5672 amqp://broker2.example.com:5672
topic_prefix = koji
connect_timeout = 10
send_timeout = 60
""")
        conf = SafeConfigParser()
        conf.readfp(confdata)
        handler = protonmsg.TimeoutHandler('amqp://broker1.example.com:5672',
                                           [], conf)
        event = MagicMock()
        handler.on_start(event)
        event.container.connect.assert_called_once_with(
            url='amqp://broker1.example.com:5672',
            reconnect=False,
            ssl_domain=None)
        self.assertEqual(SSLDomain.call_count, 0)
Пример #3
0
def test_topic_prefix(topic_prefix, expected):
    conf = ConfigParser()
    conf.add_section('broker')
    conf.set('broker', 'topic_prefix', topic_prefix)
    handler = protonmsg.TimeoutHandler('amqp://broker1.example.com:5672', [], conf)
    assert handler.topic_prefix == expected