Add test for: info: emit repo info even if repo has 0 archives (#6155)

add test for: info: emit repo info even if repo has 0 archives

In https://github.com/borgbackup/borg/pull/6152 it has been neglected to
add a regression test for the bug that has been fixed. This is the test.
This commit is contained in:
Andrey Bienkowski 2022-01-22 20:53:17 +00:00 committed by GitHub
parent 8b61fd308c
commit aa77957f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -1538,6 +1538,14 @@ class ArchiverTestCase(ArchiverTestCaseBase):
assert datetime.strptime(archive['start'], ISO_FORMAT) assert datetime.strptime(archive['start'], ISO_FORMAT)
assert datetime.strptime(archive['end'], ISO_FORMAT) assert datetime.strptime(archive['end'], ISO_FORMAT)
def test_info_json_of_empty_archive(self):
"""See https://github.com/borgbackup/borg/issues/6120"""
self.cmd('init', '--encryption=repokey', self.repository_location)
info_repo = json.loads(self.cmd('info', '--json', '--first=1', self.repository_location))
assert info_repo["archives"] == []
info_repo = json.loads(self.cmd('info', '--json', '--last=1', self.repository_location))
assert info_repo["archives"] == []
def test_comment(self): def test_comment(self):
self.create_regular_file('file1', size=1024 * 80) self.create_regular_file('file1', size=1024 * 80)
self.cmd('init', '--encryption=repokey', self.repository_location) self.cmd('init', '--encryption=repokey', self.repository_location)