Multi-platform: support multiple files per version #201
@ -597,6 +597,37 @@ class NewVersionTest(TestCase):
|
|||||||
self.assertEqual(new_version.release_notes, 'new version')
|
self.assertEqual(new_version.release_notes, 'new version')
|
||||||
|
|
||||||
|
|
||||||
|
class MultiPlatformUploadTest(TestCase):
|
||||||
|
def test_upload_more_files(self):
|
||||||
|
extension = create_version(
|
||||||
|
metadata__id="some_addon",
|
||||||
|
metadata__version="0.0.1",
|
||||||
|
).extension
|
||||||
|
file_linux = TEST_FILES_DIR / 'addon-with-split-platforms-linux.zip'
|
||||||
|
file_windows = TEST_FILES_DIR / 'addon-with-split-platforms-windows.zip'
|
||||||
|
self.client.force_login(extension.authors.all()[0])
|
||||||
|
|
||||||
|
with open(file_linux, 'rb') as fp:
|
||||||
|
response = self.client.post(
|
||||||
|
extension.get_new_version_url(),
|
||||||
|
{'source': fp, 'agreed_with_terms': True},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 302)
|
||||||
|
extension.refresh_from_db()
|
||||||
|
self.assertEqual(extension.latest_version.files.count(), 1)
|
||||||
|
self.assertEqual(extension.latest_version.platforms.count(), 1)
|
||||||
|
|
||||||
|
with open(file_windows, 'rb') as fp:
|
||||||
|
response = self.client.post(
|
||||||
|
extension.latest_version.get_version_upload_url(),
|
||||||
|
{'source': fp, 'agreed_with_terms': True},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 302)
|
||||||
|
extension.refresh_from_db()
|
||||||
|
self.assertEqual(extension.latest_version.files.count(), 2)
|
||||||
|
self.assertEqual(extension.latest_version.platforms.count(), 2)
|
||||||
|
|
||||||
|
|
||||||
class DraftsWarningTest(TestCase):
|
class DraftsWarningTest(TestCase):
|
||||||
fixtures = ['licenses']
|
fixtures = ['licenses']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user