0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

delete the FieldFile directly because the TestCase does not commit

This commit is contained in:
Gordon Pendleton 2017-04-13 09:14:55 -04:00 committed by Matt Westcott
parent 49a416431e
commit e6b462f13e
2 changed files with 7 additions and 3 deletions

View File

@ -100,8 +100,10 @@ class TestDocumentFilenameProperties(TestCase):
self.assertEqual('', self.extensionless_document.file_extension)
def tearDown(self):
self.document.delete()
self.extensionless_document.delete()
# delete the FieldFile directly because the TestCase does not commit
# transactions to trigger transaction.on_commit() in the signal handler
self.document.file.delete()
self.extensionless_document.file.delete()
class TestFilesDeletedForDefaultModels(TransactionTestCase):

View File

@ -82,7 +82,9 @@ class TestServeViewWithSendfile(TestCase):
self.document.file.save('example.doc', ContentFile("A boring example document"))
def tearDown(self):
self.document.delete()
# delete the FieldFile directly because the TestCase does not commit
# transactions to trigger transaction.on_commit() in the signal handler
self.document.file.delete()
def get(self):
return self.client.get(reverse('wagtaildocs_serve', args=(self.document.id, self.document.filename)))