Ejemplo n.º 1
0
def initialize() -> List[object]:
    """ Asks listeners to create their clients and return them for persistent during process lifetime. """
    responses = initialize_persistent_client.send_robust(None)
    clients = []

    for _current_receiver, current_response in responses:
        if isinstance(current_response, Exception):
            logger.error('CLIENTS: Init error: %s', current_response)
            continue

        if not current_response:
            continue

        # We expect all listeners to return their client instance.
        clients.append(current_response)

    return clients
Ejemplo n.º 2
0
    def test_initialize_persistent_client_signal(self, initialize_mock):
        initialize_mock.return_value = None

        self.assertFalse(initialize_mock.called)
        initialize_persistent_client.send_robust(None)
        self.assertTrue(initialize_mock.called)