[backups] Fix pg_dump not found in celery backup task

This commit is contained in:
2026-08-13 18:56:11 -04:00
parent 28cbe24f9a
commit 74d0c67f02
4 changed files with 88 additions and 2 deletions

View File

@ -5,6 +5,27 @@ import time_machine
from scrobbles import tasks as scrobbles_tasks
def test_locate_pg_dump_returns_which_result(monkeypatch):
monkeypatch.setattr(
scrobbles_tasks.shutil, "which", lambda name: "/usr/local/bin/pg_dump"
)
assert scrobbles_tasks._locate_pg_dump() == "/usr/local/bin/pg_dump"
def test_locate_pg_dump_falls_back_to_common_locations(monkeypatch):
monkeypatch.setattr(scrobbles_tasks.shutil, "which", lambda name: None)
monkeypatch.setattr(
scrobbles_tasks.glob, "glob", lambda pattern: ["/usr/local/bin/pg_dump"]
)
assert scrobbles_tasks._locate_pg_dump() == "/usr/local/bin/pg_dump"
def test_locate_pg_dump_returns_none_when_unfindable(monkeypatch):
monkeypatch.setattr(scrobbles_tasks.shutil, "which", lambda name: None)
monkeypatch.setattr(scrobbles_tasks.glob, "glob", lambda pattern: [])
assert scrobbles_tasks._locate_pg_dump() is None
class FakeWebDAVClient:
def __init__(self, files=None):
self.files = files if files is not None else {}