Multi-platform: support multiple files per version #201
@ -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(
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user