Multi-platform: support multiple files per version #201

Merged
Oleg-Komarov merged 43 commits from multi-os into main 2024-07-09 16:27:46 +02:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit 486336c960 - Show all commits

View File

@ -43,11 +43,10 @@ def _delete_versionfiles_file(
logger.info('Deleting File pk=%s of VersionFile pk=%s', file.pk, instance.pk)
file.delete()
instance.version.update_platforms()
# this code is already quite convoluted
# this code is already quite convoluted :double-facepalm:
# TODO? maybe find some way to have a predictable order of deletion
try:
instance.version.update_platforms()
if instance.version.files.count() == 0:
# this was the last file, clean up the version
logger.info(

View File

@ -216,3 +216,14 @@ class DeleteTest(TestCase):
self.assertEqual(response.status_code, 403)
extension.refresh_from_db()
def test_multi_file_version_delete(self):
version = create_version(metadata__platforms=['linux-x64'])
version.add_file(
FileFactory(
metadata__id=version.extension.extension_id,
metadata__version=version.version,
metadata__platforms=['windows-x64'],
)
)
version.extension.delete()