This commit is contained in:
lwark
2025-09-17 07:52:16 -05:00
commit a2ff72dda8
584 changed files with 52247 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
from wiki.plugins.attachments.models import Attachment
from wiki.plugins.attachments.models import AttachmentRevision
from tests.base import RequireRootArticleMixin
from tests.base import TestBase
class AttachmentRevisionTests(RequireRootArticleMixin, TestBase):
def setUp(self):
super().setUp()
self.attachment = Attachment.objects.create(
article=self.root_article,
original_filename="blah.txt",
)
self.revision = AttachmentRevision.objects.create(
attachment=self.attachment,
file=None,
description="muh",
revision_number=1,
)
def test_revision_no_file(self):
# Intentionally, there are no asserts, as the test just needs to
# target an if-branch in the pre-delete signal for AttachmentRevision
self.revision.delete()
def test_revision_file_size(self):
self.assertIsNone(self.revision.get_size())
def test_get_filename_no_file(self):
self.assertIsNone(self.revision.get_filename())
def test_str(self):
self.assertEqual(
str(self.revision),
"%s: %s (r%d)"
% (
"Root Article",
"blah.txt",
1,
),
)