diff options
author | Tomasz Niedziela-Brach <niedziela.brach@gmail.com> | 2021-04-04 17:02:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 18:02:03 +0300 |
commit | 44dcc33a74bfb497ace1071d9d4b9851fa04f561 (patch) | |
tree | af829a61d52e918d8c90c56d3b9f624f57ded62a /t | |
parent | 78cc97b549e3b58005747ecb3d160f2b60ba63ba (diff) | |
download | kombu-44dcc33a74bfb497ace1071d9d4b9851fa04f561.tar.gz |
Azure Service Bus - versatile queue names fix (#1324)
* fixed character replace table according to the comment above - dots replaced by dashes, other punctuations replaced by underscores
* optimised with precalculated punctuation set - according to @thedrow suggestion
* queue name tests
* cleanup
Diffstat (limited to 't')
-rw-r--r-- | t/unit/transport/test_azureservicebus.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/t/unit/transport/test_azureservicebus.py b/t/unit/transport/test_azureservicebus.py index 909592ec..329eeac7 100644 --- a/t/unit/transport/test_azureservicebus.py +++ b/t/unit/transport/test_azureservicebus.py @@ -275,3 +275,28 @@ def test_purge(mock_queue: MockQueue): size = mock_queue.channel._size(mock_queue.queue_name) assert size == 0 assert len(mock_queue.asb.queues[mock_queue.queue_name].waiting_ack) == 0 + + +def test_custom_queue_name_prefix(): + conn = Connection( + URL_CREDS, + transport=azureservicebus.Transport, + transport_options={'queue_name_prefix': 'test-queue'} + ) + channel = conn.channel() + + assert channel.queue_name_prefix == 'test-queue' + + +def test_custom_entity_name(): + conn = Connection(URL_CREDS, transport=azureservicebus.Transport) + channel = conn.channel() + + # dashes allowed and dots replaced by dashes + assert channel.entity_name('test-celery') == 'test-celery' + assert channel.entity_name('test.celery') == 'test-celery' + + # all other punctuations replaced by underscores + assert channel.entity_name('test_celery') == 'test_celery' + assert channel.entity_name('test:celery') == 'test_celery' + assert channel.entity_name('test+celery') == 'test_celery' |