Skip to content

Commit fa8858f

Browse files
author
Aditya Patel
committed
style: fix ruff formatting in cli.py and test_cli.py
1 parent ed43f01 commit fa8858f

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

src/netbox_data_puller/cli.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ def _write_batch_toml(
247247
for key, val in filters.items():
248248
lines.append(f'{key} = "{val}"')
249249
else:
250-
lines.append("# status = \"active\"")
251-
lines.append("# vrf = \"Production\"")
252-
lines.append("# tenant = \"Ops\"")
250+
lines.append('# status = "active"')
251+
lines.append('# vrf = "Production"')
252+
lines.append('# tenant = "Ops"')
253253
lines.append("")
254254
path.write_text("\n".join(lines))
255255

@@ -400,8 +400,7 @@ def setup(
400400
f"[bold red]❌ Connection failed:[/bold red] {exc}",
401401
)
402402
console.print(
403-
"\n[dim]Check your URL and token, then run "
404-
"'nbpull setup' again.[/dim]",
403+
"\n[dim]Check your URL and token, then run 'nbpull setup' again.[/dim]",
405404
)
406405
raise typer.Exit(code=2) from exc
407406

@@ -419,9 +418,7 @@ def setup(
419418
all_ok = True
420419
for endpoint, ok, detail in probe_results:
421420
status_text = (
422-
"[bold green]✅ Pass[/bold green]"
423-
if ok
424-
else "[bold red]❌ Fail[/bold red]"
421+
"[bold green]✅ Pass[/bold green]" if ok else "[bold red]❌ Fail[/bold red]"
425422
)
426423
if not ok:
427424
all_ok = False

tests/test_cli.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,7 @@ def test_setup_existing_env_keep(
565565
monkeypatch.chdir(tmp_path)
566566
env_file = tmp_path / ".env"
567567
env_file.write_text(
568-
"NETBOX_URL=https://old.example.com\n"
569-
"NETBOX_TOKEN=old-token-1234\n",
568+
"NETBOX_URL=https://old.example.com\nNETBOX_TOKEN=old-token-1234\n",
570569
)
571570
mock_probe.return_value = MOCK_PROBE_ALL_OK
572571
# Answer 'n' to overwrite, 'n' to batch
@@ -591,8 +590,7 @@ def test_setup_existing_env_overwrite(
591590
monkeypatch.chdir(tmp_path)
592591
env_file = tmp_path / ".env"
593592
env_file.write_text(
594-
"NETBOX_URL=https://old.example.com\n"
595-
"NETBOX_TOKEN=old-token-1234\n",
593+
"NETBOX_URL=https://old.example.com\nNETBOX_TOKEN=old-token-1234\n",
596594
)
597595
mock_probe.return_value = MOCK_PROBE_ALL_OK
598596
# Answer 'y' to overwrite, provide new URL + token, decline batch
@@ -617,8 +615,7 @@ def test_setup_token_masked(
617615
monkeypatch.chdir(tmp_path)
618616
env_file = tmp_path / ".env"
619617
env_file.write_text(
620-
"NETBOX_URL=https://netbox.example.com\n"
621-
"NETBOX_TOKEN=abcdefgh1234\n",
618+
"NETBOX_URL=https://netbox.example.com\nNETBOX_TOKEN=abcdefgh1234\n",
622619
)
623620
mock_probe.return_value = MOCK_PROBE_ALL_OK
624621
result = runner.invoke(

0 commit comments

Comments
 (0)