def test_set_ssl(config, conn_mock): calls = [ mock.call(for_hosts=(('localhost', 6163), ), cert_file='tests/fixtures/activemq_cert.pem', key_file='tests/fixtures/activemq_private.pem', ca_certs='tests/fixtures/ca.pem'), mock.call(for_hosts=(('localhost', 6164), ), cert_file='tests/fixtures/activemq_cert.pem', key_file='tests/fixtures/activemq_private.pem', ca_certs='tests/fixtures/ca.pem'), ] ConnectorFake(config, conn_mock) assert conn_mock.transport.set_ssl.call_args_list == calls
def test_set_ssl(config, conn_mock): calls = [ mock.call(for_hosts=(('localhost', 6163),), cert_file='tests/fixtures/activemq_cert.pem', key_file='tests/fixtures/activemq_private.pem', ca_certs='tests/fixtures/ca.pem'), mock.call(for_hosts=(('localhost', 6164),), cert_file='tests/fixtures/activemq_cert.pem', key_file='tests/fixtures/activemq_private.pem', ca_certs='tests/fixtures/ca.pem'), ] ConnectorFake(config, conn_mock) assert conn_mock.transport.set_ssl.call_args_list == calls
def test_receive__sets_single_response_listener(self, listener, fake_connector, conn_mock): fake_connector.receive(5) assert mock.call('response_listener', listener.return_value ) in conn_mock.set_listener.call_args_list
def test_exceptions_are_logged(self, get_security, result_listener, logger): exc = scanner.ScannerError() get_security.return_value.decode.side_effect = exc result_listener.on_message(body='--- :this is not valid yaml:', headers={}) logger.debug.assert_has_calls( [mock.call('Exception caught when decoding message body')] ) logger.exception.assert_called_once_with(exc)
def test_wait_loop__exits_on_timeout(time, result_listener, condition): time.side_effect = (0, 2, 3, 6) result_listener._wait_loop(5) assert condition.wait.call_args_list == [mock.call(5), mock.call(3)]
def test_receive__sets_single_response_listener(self, listener, fake_connector, conn_mock): fake_connector.receive(5) assert mock.call( 'response_listener', listener.return_value) in conn_mock.set_listener.call_args_list