selfprivacy-rest-api/tests/test_graphql/test_backup.py

43 lines
1.1 KiB
Python
Raw Normal View History

2023-02-03 17:04:35 +00:00
import pytest
import os.path as path
2023-02-03 17:04:35 +00:00
from selfprivacy_api.services.test_service import DummyService
2023-02-01 11:58:55 +00:00
import selfprivacy_api.backup.providers as providers
from selfprivacy_api.backup.providers import AbstractBackupProvider
from selfprivacy_api.backup.providers.backblaze import Backblaze
from selfprivacy_api.graphql.queries.providers import BackupProvider
TESTFILE_BODY = "testytest!"
2023-02-03 17:04:35 +00:00
@pytest.fixture()
def test_service(tmpdir):
testile_path = path.join(tmpdir, "testfile.txt")
with open(testile_path, "w") as file:
file.write(TESTFILE_BODY)
2023-02-03 17:04:35 +00:00
return DummyService(tmpdir)
@pytest.fixture()
def memory_backup():
ProviderClass = providers.get_provider(BackupProvider.MEMORY)
assert ProviderClass is not None
memory_provider = ProviderClass(login="", key="")
assert memory_provider is not None
return memory_provider
2023-02-01 11:58:55 +00:00
def test_select_backend():
provider = providers.get_provider(BackupProvider.BACKBLAZE)
assert provider is not None
assert provider == Backblaze
2023-02-03 17:04:35 +00:00
def test_backup_service(test_service, memory_backup):
2023-02-03 17:04:35 +00:00
# temporarily incomplete
assert test_service is not None
assert memory_backup is not None