Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 21, 2023
1 parent 2c147f4 commit a5d2370
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions panel/tests/ui/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@


@unix_only
def test_basic_auth(py_file, page):
@pytest.mark.parametrize('prefix', ['', 'prefix'])
def test_basic_auth(py_file, page, prefix):
app = "import panel as pn; pn.pane.Markdown(pn.state.user).servable(title='A')"
write_file(app, py_file.file)

app_name = os.path.basename(py_file.name)[:-3]

with run_panel_serve(["--port", "0", "--basic-auth", "my_password", "--cookie-secret", "secret", py_file.name]) as p:
cmd = ["--port", "0", "--basic-auth", "my_password", "--cookie-secret", "secret", py_file.name]
if prefix:
app_name = f'{prefix}/{app_name}'
cmd += ['--prefix', prefix]
print(app_name)
with run_panel_serve(cmd) as p:
port = wait_for_port(p.stdout)
page.goto(f"http://localhost:{port}/{app_name}")

Expand Down

0 comments on commit a5d2370

Please sign in to comment.