Support for platforms and wheels #131
BIN
extensions/tests/files/invalid-missing-wheels.zip
Normal file
BIN
extensions/tests/files/invalid-missing-wheels.zip
Normal file
Binary file not shown.
@ -84,6 +84,11 @@ EXPECTED_VALIDATION_ERRORS = {
|
|||||||
},
|
},
|
||||||
'invalid-manifest-toml.zip': {'source': ['Could not parse the manifest file.']},
|
'invalid-manifest-toml.zip': {'source': ['Could not parse the manifest file.']},
|
||||||
'invalid-theme-multiple-xmls.zip': {'source': ['A theme should have exactly one XML file.']},
|
'invalid-theme-multiple-xmls.zip': {'source': ['A theme should have exactly one XML file.']},
|
||||||
|
'invalid-missing-wheels.zip': {
|
||||||
|
'source': [
|
||||||
|
'A declared wheel is missing in the zip file, expected path: addon/./wheels/test-wheel-whatever.whl'
|
||||||
|
]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
POST_DATA = {
|
POST_DATA = {
|
||||||
'preview_set-TOTAL_FORMS': ['0'],
|
'preview_set-TOTAL_FORMS': ['0'],
|
||||||
@ -169,13 +174,13 @@ class SubmitFileTest(TestCase):
|
|||||||
user = UserFactory()
|
user = UserFactory()
|
||||||
self.client.force_login(user)
|
self.client.force_login(user)
|
||||||
|
|
||||||
for test_archive, extected_errors in EXPECTED_VALIDATION_ERRORS.items():
|
for test_archive, expected_errors in EXPECTED_VALIDATION_ERRORS.items():
|
||||||
with self.subTest(test_archive=test_archive):
|
with self.subTest(test_archive=test_archive):
|
||||||
with open(TEST_FILES_DIR / test_archive, 'rb') as fp:
|
with open(TEST_FILES_DIR / test_archive, 'rb') as fp:
|
||||||
response = self.client.post(self.url, {'source': fp, 'agreed_with_terms': True})
|
response = self.client.post(self.url, {'source': fp, 'agreed_with_terms': True})
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertDictEqual(response.context['form'].errors, extected_errors)
|
self.assertDictEqual(response.context['form'].errors, expected_errors)
|
||||||
|
|
||||||
def test_addon_without_top_level_directory(self):
|
def test_addon_without_top_level_directory(self):
|
||||||
self.assertEqual(Extension.objects.count(), 0)
|
self.assertEqual(Extension.objects.count(), 0)
|
||||||
|
@ -39,7 +39,7 @@ class FileForm(forms.ModelForm):
|
|||||||
'missing_or_multiple_theme_xml': _('A theme should have exactly one XML file.'),
|
'missing_or_multiple_theme_xml': _('A theme should have exactly one XML file.'),
|
||||||
'invalid_zip_archive': msg_only_zip_files,
|
'invalid_zip_archive': msg_only_zip_files,
|
||||||
'missing_manifest_toml': _('The manifest file is missing.'),
|
'missing_manifest_toml': _('The manifest file is missing.'),
|
||||||
'missing_wheel': _('A declared wheel is missing in the zip file, expected_path: {path}'),
|
'missing_wheel': _('A declared wheel is missing in the zip file, expected path: %(path)s'),
|
||||||
}
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
Loading…
Reference in New Issue
Block a user