sanity checker testing

This commit is contained in:
jonaswinkler
2021-02-10 00:52:18 +01:00
parent 9246411610
commit 34e84cc757
2 changed files with 18 additions and 7 deletions

View File

@@ -87,20 +87,18 @@ def check_sanity():
f"Stored: {doc.checksum}, actual: {checksum}."
))
# Check sanity of the archive file.
if doc.archive_checksum and not doc.archive_filename:
messages.append(SanityError(
f"Document {doc.pk} has an archive file checksum, but no "
f"archive filename."
))
if not doc.archive_checksum and doc.archive_filename:
elif not doc.archive_checksum and doc.archive_filename:
messages.append(SanityError(
f"Document {doc.pk} has an archive file, but its checksum is "
f"missing."
))
# Check sanity of the archive file.
if doc.has_archive_version:
elif doc.has_archive_version:
if not os.path.isfile(doc.archive_path):
messages.append(SanityError(
f"Archived version of document {doc.pk} does not exist."