mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 20:11:30 +00:00
test(backups): test that we do return snapshot on backup
This commit is contained in:
parent
2eb64db199
commit
ae065867b3
|
@ -87,6 +87,7 @@ class ResticBackuper(AbstractBackuper):
|
||||||
for message in messages:
|
for message in messages:
|
||||||
if message["message_type"] == "summary":
|
if message["message_type"] == "summary":
|
||||||
return ResticBackuper._snapshot_from_fresh_summary(message, repo_name)
|
return ResticBackuper._snapshot_from_fresh_summary(message, repo_name)
|
||||||
|
raise ValueError("no summary message in restic json output")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _snapshot_from_fresh_summary(message: object, repo_name) -> Snapshot:
|
def _snapshot_from_fresh_summary(message: object, repo_name) -> Snapshot:
|
||||||
|
|
|
@ -130,6 +130,17 @@ def test_one_snapshot(backups, dummy_service):
|
||||||
assert snap.service_name == dummy_service.get_id()
|
assert snap.service_name == dummy_service.get_id()
|
||||||
|
|
||||||
|
|
||||||
|
def test_backup_returns_snapshot(backups, dummy_service):
|
||||||
|
service_folder = dummy_service.get_location()
|
||||||
|
provider = Backups.provider()
|
||||||
|
name = dummy_service.get_id()
|
||||||
|
snapshot = provider.backuper.start_backup(service_folder, name)
|
||||||
|
|
||||||
|
assert snapshot.id is not None
|
||||||
|
assert snapshot.service_name == name
|
||||||
|
assert snapshot.created_at is not None
|
||||||
|
|
||||||
|
|
||||||
def test_restore(backups, dummy_service):
|
def test_restore(backups, dummy_service):
|
||||||
service_folder = dummy_service.get_location()
|
service_folder = dummy_service.get_location()
|
||||||
file_to_nuke = listdir(service_folder)[0]
|
file_to_nuke = listdir(service_folder)[0]
|
||||||
|
|
Loading…
Reference in a new issue