mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-04 18:53:10 +00:00
test(backups): localfile repo by default in tests
This commit is contained in:
parent
e091fbd4a2
commit
06deb83b33
|
@ -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:
|
||||||
|
|
|
@ -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():
|
||||||
|
|
Loading…
Reference in a new issue