Exemplo n.º 1
0
def test_queue_name(monkeypatch: Any) -> None:
    _uuid = "5d0b530f-5c44-4981-b01f-342801bd48f5"
    queue_name = AmqpTransport.get_queue_name("test.topic", "func", _uuid,
                                              False, {})
    assert queue_name == "b444917b9b922e8c29235737c7775c823e092c2374d1bfde071d42c637e3b4fd"

    queue_name = AmqpTransport.get_queue_name("test.topic", "func2", _uuid,
                                              False, {})
    assert queue_name != "b444917b9b922e8c29235737c7775c823e092c2374d1bfde071d42c637e3b4fd"

    queue_name = AmqpTransport.get_queue_name(
        "test.topic", "func", _uuid, False,
        {"options": {
            "amqp": {
                "queue_name_prefix": "prefix-"
            }
        }})
    assert queue_name == "prefix-b444917b9b922e8c29235737c7775c823e092c2374d1bfde071d42c637e3b4fd"

    queue_name = AmqpTransport.get_queue_name("test.topic", "func", _uuid,
                                              True, {})
    assert queue_name == "540e8e5bc604e4ea618f7e0517a04f030ad1dcbff2e121e9466ddd1c811450bf"

    queue_name = AmqpTransport.get_queue_name("test.topic", "func2", _uuid,
                                              True, {})
    assert queue_name == "540e8e5bc604e4ea618f7e0517a04f030ad1dcbff2e121e9466ddd1c811450bf"

    queue_name = AmqpTransport.get_queue_name(
        "test.topic", "func", _uuid, True,
        {"options": {
            "amqp": {
                "queue_name_prefix": "prefix-"
            }
        }})
    assert queue_name == "prefix-540e8e5bc604e4ea618f7e0517a04f030ad1dcbff2e121e9466ddd1c811450bf"
Exemplo n.º 2
0
def test_queue_name(monkeypatch: Any) -> None:
    _uuid = '5d0b530f-5c44-4981-b01f-342801bd48f5'
    queue_name = AmqpTransport.get_queue_name('test.topic', 'func', _uuid, False, {})
    assert queue_name == 'b444917b9b922e8c29235737c7775c823e092c2374d1bfde071d42c637e3b4fd'

    queue_name = AmqpTransport.get_queue_name('test.topic', 'func2', _uuid, False, {})
    assert queue_name != 'b444917b9b922e8c29235737c7775c823e092c2374d1bfde071d42c637e3b4fd'

    queue_name = AmqpTransport.get_queue_name('test.topic', 'func', _uuid, False, {'options': {'amqp': {'queue_name_prefix': 'prefix-'}}})
    assert queue_name == 'prefix-b444917b9b922e8c29235737c7775c823e092c2374d1bfde071d42c637e3b4fd'

    queue_name = AmqpTransport.get_queue_name('test.topic', 'func', _uuid, True, {})
    assert queue_name == '540e8e5bc604e4ea618f7e0517a04f030ad1dcbff2e121e9466ddd1c811450bf'

    queue_name = AmqpTransport.get_queue_name('test.topic', 'func2', _uuid, True, {})
    assert queue_name == '540e8e5bc604e4ea618f7e0517a04f030ad1dcbff2e121e9466ddd1c811450bf'

    queue_name = AmqpTransport.get_queue_name('test.topic', 'func', _uuid, True, {'options': {'amqp': {'queue_name_prefix': 'prefix-'}}})
    assert queue_name == 'prefix-540e8e5bc604e4ea618f7e0517a04f030ad1dcbff2e121e9466ddd1c811450bf'