def test_get_resource_types(self): command = DeleteOrphanedMediaCommand() expected = { RESOURCE_TYPES['RAW'], RESOURCE_TYPES['IMAGE'], RESOURCE_TYPES['VIDEO'] } self.assertEqual(expected, command.get_resource_types())
def test_files_to_remove(self): command = DeleteOrphanedMediaCommand() expected = { RESOURCE_TYPES['RAW']: {self.file_removed, self.file_removed_2}, RESOURCE_TYPES['IMAGE']: set(), RESOURCE_TYPES['VIDEO']: set() } self.assertEqual(command.get_files_to_remove(), expected)
def test_files_to_remove_with_exclude_setting(self): app_settings.EXCLUDE_DELETE_ORPHANED_MEDIA_PATHS = ('tests/', ) command = DeleteOrphanedMediaCommand() expected = { RESOURCE_TYPES['RAW']: set(), RESOURCE_TYPES['IMAGE']: set(), RESOURCE_TYPES['VIDEO']: set() } self.assertEqual(command.get_files_to_remove(), expected) app_settings.EXCLUDE_DELETE_ORPHANED_MEDIA_PATHS = ()
def test_get_uploaded_media(self): command = DeleteOrphanedMediaCommand() self.assertEqual(command.get_needful_files(), {self.file, self.file_2, self.file_3, self.file_4})
def test_get_file_storage_for_image_resource_type(self): command = DeleteOrphanedMediaCommand() storage = command.get_file_storage(RESOURCE_TYPES['IMAGE']) self.assertEqual(storage, storages_per_type[RESOURCE_TYPES['IMAGE']])