mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-08 05:42:27 +00:00
test(cli): fix windows path assertions in export endpoints
- Fixes `AssertionError: assert {'path': '\\tmp\\exported.md'} == {'path': '/tmp/exported.md'}` by checking against both `\tmp\exported.md` and `/tmp/exported.md` in `src/tests/test_api_new_endpoints.py`
- Fixes `AssertionError: assert '/tmp/doc.txt' in '\\tmp\\doc.txt\n'` by checking for both variations in `src/tests/test_cli_entry_add_commands.py`
- Runs `black` to format unformatted tests and CLI code to fix lint/formatting failures.
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
d71e7d6bc9
commit
c933bcd43f
9 files changed
+68
-23
No files matched your search
+16
-5
@@ -7,7 +7,10 @@ import typer
|
||||
import uvicorn
|
||||
|
||||
from .. import api as api_module
|
||||
from seedpass.core.auth_broker import AuthBrokerError, resolve_password as resolve_broker_password
|
||||
from seedpass.core.auth_broker import (
|
||||
AuthBrokerError,
|
||||
resolve_password as resolve_broker_password,
|
||||
)
|
||||
|
||||
app = typer.Typer(help="Run the API server")
|
||||
|
||||
@@ -18,16 +21,22 @@ def api_start(
|
||||
host: str = "127.0.0.1",
|
||||
port: int = 8000,
|
||||
unlock: bool = typer.Option(
|
||||
False, "--unlock", help="Unlock vault during startup using the selected auth broker"
|
||||
False,
|
||||
"--unlock",
|
||||
help="Unlock vault during startup using the selected auth broker",
|
||||
),
|
||||
auth_broker: str = typer.Option(
|
||||
"prompt",
|
||||
"--auth-broker",
|
||||
help="Password source when --unlock is used (prompt|env|keyring|command)",
|
||||
click_type=click.Choice(["prompt", "env", "keyring", "command"], case_sensitive=False),
|
||||
click_type=click.Choice(
|
||||
["prompt", "env", "keyring", "command"], case_sensitive=False
|
||||
),
|
||||
),
|
||||
password_env: str = typer.Option(
|
||||
"SEEDPASS_PASSWORD", "--password-env", help="Env var used when --auth-broker=env"
|
||||
"SEEDPASS_PASSWORD",
|
||||
"--password-env",
|
||||
help="Env var used when --auth-broker=env",
|
||||
),
|
||||
broker_service: str = typer.Option(
|
||||
"seedpass",
|
||||
@@ -51,7 +60,9 @@ def api_start(
|
||||
if auth_broker.lower() == "prompt":
|
||||
unlock_password = typer.prompt("Master password", hide_input=True)
|
||||
else:
|
||||
account = broker_account or str((ctx.obj or {}).get("fingerprint") or "default")
|
||||
account = broker_account or str(
|
||||
(ctx.obj or {}).get("fingerprint") or "default"
|
||||
)
|
||||
try:
|
||||
unlock_password = resolve_broker_password(
|
||||
broker=auth_broker,
|
||||
|
||||
Reference in new issue
Block a user