Skip to content

Commit a8d7421

Browse files
committed
Parameterize test for url with prefix
1 parent 5540f41 commit a8d7421

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

tests/test_cli.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,12 @@ def test_run_env_vars_and_args() -> None:
394394

395395
@pytest.mark.parametrize("command", ["dev", "run"])
396396
@pytest.mark.parametrize(
397-
"public_url", ["https://myapp.example.com", "https://myapp.example.com/"]
397+
"public_url",
398+
[
399+
"https://myapp.example.com",
400+
"https://myapp.example.com/",
401+
"https://myapp.example.com/subpath/",
402+
],
398403
)
399404
def test_public_url(command: str, public_url: str) -> None:
400405
with changing_dir(assets_path):
@@ -431,13 +436,19 @@ def test_public_url(command: str, public_url: str) -> None:
431436
f"Starting {'development' if command == 'dev' else 'production'} server 🚀"
432437
in result.output
433438
)
434-
assert "Server started at https://myapp.example.com" in result.output
435-
assert "Documentation at https://myapp.example.com/docs" in result.output
439+
expected_url_base = public_url.rstrip("/")
440+
assert f"Server started at {expected_url_base}" in result.output
441+
assert f"Documentation at {expected_url_base}/docs" in result.output
436442

437443

438444
@pytest.mark.parametrize("command", ["dev", "run"])
439445
@pytest.mark.parametrize(
440-
"public_url", ["https://myapp.example.com", "https://myapp.example.com/"]
446+
"public_url",
447+
[
448+
"https://myapp.example.com",
449+
"https://myapp.example.com/",
450+
"https://myapp.example.com/subpath/",
451+
],
441452
)
442453
def test_public_url_env_var(command: str, public_url: str) -> None:
443454
with changing_dir(assets_path):
@@ -473,8 +484,9 @@ def test_public_url_env_var(command: str, public_url: str) -> None:
473484
f"Starting {'development' if command == 'dev' else 'production'} server 🚀"
474485
in result.output
475486
)
476-
assert "Server started at https://myapp.example.com" in result.output
477-
assert "Documentation at https://myapp.example.com/docs" in result.output
487+
expected_url_base = public_url.rstrip("/")
488+
assert f"Server started at {expected_url_base}" in result.output
489+
assert f"Documentation at {expected_url_base}/docs" in result.output
478490

479491

480492
def test_run_error() -> None:

0 commit comments

Comments
 (0)