mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-26 05:51:29 +00:00
test(backups): localfile repo by default in tests
This commit is contained in:
parent
add4e21f39
commit
a280e5c999
|
@ -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