From 090198c3006a2a766237fffcc82d11a80d6cf8b3 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 20 Feb 2023 13:51:06 +0000 Subject: [PATCH] test(backups): localfile repo by default in tests --- selfprivacy_api/backup/__init__.py | 9 ++++++++- tests/test_graphql/test_backup.py | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/selfprivacy_api/backup/__init__.py b/selfprivacy_api/backup/__init__.py index 210c998..d948d34 100644 --- a/selfprivacy_api/backup/__init__.py +++ b/selfprivacy_api/backup/__init__.py @@ -15,9 +15,16 @@ class Backups(metaclass=SingletonMetaclass): provider: AbstractBackupProvider - def __init__(self): + def __init__(self, test_repo_file: str = ""): + if test_repo_file != "": + self.set_localfile_repo(test_repo_file) self.lookup_provider() + def set_localfile_repo(self, file_path: str): + ProviderClass = get_provider(BackupProvider.FILE) + provider = ProviderClass(file_path) + self.provider = provider + def lookup_provider(self): redis_provider = Backups.load_provider_redis() if redis_provider is not None: diff --git a/tests/test_graphql/test_backup.py b/tests/test_graphql/test_backup.py index 33ecc65..28ef828 100644 --- a/tests/test_graphql/test_backup.py +++ b/tests/test_graphql/test_backup.py @@ -50,8 +50,9 @@ def file_backup(tmpdir) -> AbstractBackupProvider: @pytest.fixture() -def backups(): - return Backups() +def backups(tmpdir): + test_repo_path = path.join(tmpdir, "test_repo") + return Backups(test_repo_path) def test_select_backend():