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 """) if six.PY2: conf = SafeConfigParser() conf.readfp(confdata) else: conf = ConfigParser() conf.read_file(confdata) self.handler = protonmsg.TimeoutHandler('amqps://broker1.example.com:5671', [], conf)
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 """) if six.PY2: conf = SafeConfigParser() conf.readfp(confdata) else: conf = ConfigParser() conf.read_file(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)