示例#1
0
    def test_delete_orphaned_file(self):
        orphan_filepath = os.path.join(settings.MEDIA_ROOT, 'IM_AN_ORPHANED_FILE.csv')
        open(orphan_filepath, 'w').close()

        PurgeOrphanedUploadsTask.apply_async()

        self.assertEqual(os.path.exists(orphan_filepath), False)
示例#2
0
    def test_delete_orphaned_data_upload(self):
        self.upload.dataset = None
        self.upload.save()

        PurgeOrphanedUploadsTask.apply_async()

        with self.assertRaises(DataUpload.DoesNotExist):
            DataUpload.objects.get(id=self.upload.id)

        self.assertEqual(os.path.exists(self.upload.get_path()), False)
示例#3
0
    def test_dont_delete_related_file(self):
        PurgeOrphanedUploadsTask.apply_async()

        self.assertEqual(os.path.exists(self.related.get_path()), True)