test(backups): localfile repo by default in tests

This commit is contained in:
Houkime 2023-02-20 13:51:06 +00:00
parent e091fbd4a2
commit 06deb83b33
2 changed files with 11 additions and 3 deletions

View file

@ -15,9 +15,16 @@ class Backups(metaclass=SingletonMetaclass):
provider: AbstractBackupProvider 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() 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): def lookup_provider(self):
redis_provider = Backups.load_provider_redis() redis_provider = Backups.load_provider_redis()
if redis_provider is not None: if redis_provider is not None:

View file

@ -50,8 +50,9 @@ def file_backup(tmpdir) -> AbstractBackupProvider:
@pytest.fixture() @pytest.fixture()
def backups(): def backups(tmpdir):
return Backups() test_repo_path = path.join(tmpdir, "test_repo")
return Backups(test_repo_path)
def test_select_backend(): def test_select_backend():