Beispiel #1
0
 def test_get_urls_user_passwd_config_mixed(self):
     config['username'] = '******'
     config['password'] = '******'
     self.assertEqual(
         get_urls('amqps://args1.example,amqps://user:[email protected]'),
         [
             'amqps://*****:*****@args1.example',
             'amqps://*****:*****@args2.example'
         ])
Beispiel #2
0
    def __init__(
        self,
        server_url: Optional[str] = None,
        container_class: Type[Container] = Container,
        reconnect_strategy: ReconnectStrategy = ReconnectStrategy.backoff
    ) -> None:
        super().__init__(auto_accept=False)
        self.server_urls = get_urls(server_url)

        self.run_state = RunState.stopped
        self.failover_count = 0
        self.container_class = container_class
        self.reconnect_strategy = reconnect_strategy
        self.close_event = AsyncioEvent()
        self.close_event.set()
        self.connection: Connection
        self.container: Container
Beispiel #3
0
 def test_get_urls_activemq_format_comma_seperated(self):
     self.assertEqual(
         get_urls('amqp+ssl://args1.example, amqp+ssl://args2.example'),
         ['amqps://args1.example', 'amqps://args2.example'])
Beispiel #4
0
 def test_get_urls_activemq_format(self):
     self.assertEqual(get_urls('amqp+ssl://args.example'),
                      ['amqps://args.example'])
Beispiel #5
0
 def test_get_urls_comma_seperated(self):
     self.assertEqual(
         get_urls('amqps://args1.example, amqps://args2.example'),
         ['amqps://args1.example', 'amqps://args2.example'])
Beispiel #6
0
    def test_get_urls_priority_from_args(self):
        environ['AMQP_SERVERS'] = 'amqps://environ.example'
        configure({'amqp_url': 'amqps://config.example'})

        self.assertEqual(get_urls('amqps://args.example'),
                         ['amqps://args.example'])
Beispiel #7
0
 def test_get_urls_priority_from_environ(self):
     environ['AMQP_SERVERS'] = 'amqps://environ.example'
     self.assertEqual(get_urls(), ['amqps://environ.example'])
Beispiel #8
0
    def test_no_config(self):
        with suppress(KeyError):
            del environ['AMQP_SERVERS']

        with self.assertRaises(ValueError):
            get_urls()