delete the FieldFile directly because the TestCase does not commit

pull/3853/merge
Gordon Pendleton 2017-04-13 09:14:55 -04:00 zatwierdzone przez Matt Westcott
rodzic 49a416431e
commit e6b462f13e
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -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):

Wyświetl plik

@ -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)))