Extra validation of the uploaded ZIP #73
@ -7,7 +7,7 @@ from common.tests.factories.files import FileFactory
|
|||||||
from common.tests.factories.teams import TeamFactory
|
from common.tests.factories.teams import TeamFactory
|
||||||
from files.models import File
|
from files.models import File
|
||||||
from constants.version_permissions import VERSION_PERMISSION_FILE, VERSION_PERMISSION_NETWORK
|
from constants.version_permissions import VERSION_PERMISSION_FILE, VERSION_PERMISSION_NETWORK
|
||||||
from constants.licenses import LICENSE_GPL2
|
from constants.licenses import LICENSE_GPL2, LICENSE_GPL3
|
||||||
from extensions.models import Extension, Tag
|
from extensions.models import Extension, Tag
|
||||||
|
|
||||||
FILE_SOURCES = {
|
FILE_SOURCES = {
|
||||||
@ -54,6 +54,7 @@ to setup the `addon preferences`.
|
|||||||
|
|
||||||
...
|
...
|
||||||
'''
|
'''
|
||||||
|
LICENSES = (LICENSE_GPL2.id, LICENSE_GPL3.id)
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@ -100,7 +101,7 @@ class Command(BaseCommand):
|
|||||||
# Create a few publicly listed extensions
|
# Create a few publicly listed extensions
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
extension__type = random.choice(Extension.TYPES)[0]
|
extension__type = random.choice(Extension.TYPES)[0]
|
||||||
create_approved_version(
|
version = create_approved_version(
|
||||||
file__status=File.STATUSES.APPROVED,
|
file__status=File.STATUSES.APPROVED,
|
||||||
# extension__status=Extension.STATUSES.APPROVED,
|
# extension__status=Extension.STATUSES.APPROVED,
|
||||||
extension__type=extension__type,
|
extension__type=extension__type,
|
||||||
@ -116,16 +117,20 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
for i in range(random.randint(1, len(LICENSES))):
|
||||||
|
version.licenses.add(LICENSES[i])
|
||||||
|
|
||||||
# Create a few unlisted extension versions
|
# Create a few unlisted extension versions
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
extension__type = random.choice(Extension.TYPES)[0]
|
extension__type = random.choice(Extension.TYPES)[0]
|
||||||
create_version(
|
version = create_version(
|
||||||
file__status=random.choice(
|
file__status=random.choice(
|
||||||
(File.STATUSES.DISABLED, File.STATUSES.DISABLED_BY_AUTHOR)
|
(File.STATUSES.DISABLED, File.STATUSES.DISABLED_BY_AUTHOR)
|
||||||
),
|
),
|
||||||
tags=random.sample(tags[extension__type], k=1),
|
tags=random.sample(tags[extension__type], k=1),
|
||||||
)
|
)
|
||||||
|
for i in range(random.randint(1, len(LICENSES))):
|
||||||
|
version.licenses.add(LICENSES[i])
|
||||||
|
|
||||||
example_version.extension.average_score = 5.0
|
example_version.extension.average_score = 5.0
|
||||||
example_version.extension.save(update_fields={'average_score'})
|
example_version.extension.save(update_fields={'average_score'})
|
||||||
|
Loading…
Reference in New Issue
Block a user