Skip to content

Commit

Permalink
Update test_url_builder.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik authored Dec 15, 2024
1 parent 5372b04 commit 66e9df0
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions tests/brokers/rabbit/test_url_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,33 @@
from faststream.rabbit.utils import build_url


class TestUrlBuilder:
@pytest.mark.parametrize(
("url_kwargs", "expected_url"),
[
pytest.param(
{},
URL("amqp://guest:guest@localhost:5672/"), # pragma: allowlist secret
id="blank_params_use_defaults",
@pytest.mark.parametrize(
("url_kwargs", "expected_url"),
[
pytest.param(
{},
URL("amqp://guest:guest@localhost:5672/"), # pragma: allowlist secret
id="blank params use defaults",
),
pytest.param(
{"ssl": True},
URL("amqps://guest:guest@localhost:5672/"), # pragma: allowlist secret
id="ssl affects protocol",
),
pytest.param(
{"url": "fake", "virtualhost": "/", "host": "host"},
URL("amqp://guest:guest@host:5672/"), # pragma: allowlist secret
id="kwargs overrides url",
),
pytest.param(
{"virtualhost": "//test"}, # pragma: allowlist secret
URL(
"amqp://guest:guest@localhost:5672//test" # pragma: allowlist secret
),
pytest.param(
{"ssl": True},
URL("amqps://guest:guest@localhost:5672/"), # pragma: allowlist secret
id="use_ssl",
),
pytest.param(
{"url": "fake", "virtualhost": "/", "host": "host"},
URL("amqp://guest:guest@host:5672/"), # pragma: allowlist secret
id="overrides_and_default_vh",
),
pytest.param(
{"virtualhost": "//test"}, # pragma: allowlist secret
URL(
"amqp://guest:guest@localhost:5672//test" # pragma: allowlist secret
),
id="exotic_virtualhost",
),
],
)
def test_unpack_args(self, url_kwargs: Dict[str, Any], expected_url: URL) -> None:
url = build_url(**url_kwargs)
assert url == expected_url
id="exotic virtualhost",
),
],
)
def test_unpack_args(self, url_kwargs: Dict[str, Any], expected_url: URL) -> None:
url = build_url(**url_kwargs)
assert url == expected_url

0 comments on commit 66e9df0

Please sign in to comment.