Added test and small fixes
This commit is contained in:
@@ -66,6 +66,15 @@ class CalibreClient:
|
||||
return "error"
|
||||
|
||||
|
||||
def test_connection(cfg: CalibreConfig) -> tuple[bool, str]:
|
||||
try:
|
||||
client = CalibreClient(cfg)
|
||||
client._ensure_auth()
|
||||
return True, f"Authenticated to {cfg.url} as '{cfg.user}'."
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
|
||||
|
||||
def _sha256(path: Path) -> str:
|
||||
h = hashlib.sha256()
|
||||
with path.open("rb") as f:
|
||||
|
||||
Reference in New Issue
Block a user