Skip to content

Commit

Permalink
test: extend test for parse_cli_args
Browse files Browse the repository at this point in the history
  • Loading branch information
sehat1137 committed Nov 24, 2024
1 parent eef489e commit d9ae932
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/cli/utils/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from faststream.cli.utils.parser import parse_cli_args
from faststream.cli.utils.parser import is_bind_arg, parse_cli_args

APPLICATION = "module:app"

Expand Down Expand Up @@ -52,3 +52,13 @@ def test_custom_argument_parsing(args: Tuple[str]):
"k7": ["1", "2", "3"],
"bind": ["[::]:8000", "0.0.0.0:8000", "fd://2"],
}


@pytest.mark.parametrize("args", ["0.0.0.0:8000", "[::]:8000", "fd://2", "/tmp/socket.sock"])
def test_bind_arg(args: str):
assert is_bind_arg(args) is True


@pytest.mark.parametrize("args", ["main:app", "src.main:app", "examples.nats.e01_basic:app2"])
def test_not_bind_arg(args: str):
assert is_bind_arg(args) is False

0 comments on commit d9ae932

Please sign in to comment.