set task user in add_static_theme_from_lwt so passes validation (#9709)
This commit is contained in:
Родитель
b0104824e7
Коммит
ec767342ad
|
@ -12,7 +12,7 @@ from django.utils import translation
|
|||
from elasticsearch_dsl import Search
|
||||
from PIL import Image
|
||||
|
||||
import olympia.core.logger
|
||||
import olympia.core
|
||||
from olympia import amo, activity
|
||||
from olympia.addons.indexers import AddonIndexer
|
||||
from olympia.addons.models import (
|
||||
|
@ -542,6 +542,7 @@ def _get_lwt_default_author():
|
|||
@transaction.atomic
|
||||
def add_static_theme_from_lwt(lwt):
|
||||
from olympia.activity.models import AddonLog
|
||||
olympia.core.set_user(UserProfile.objects.get(pk=settings.TASK_USER_ID))
|
||||
# Try to handle LWT with no authors
|
||||
author = (lwt.listed_authors or [_get_lwt_default_author()])[0]
|
||||
# Wrap zip in FileUpload for Addon/Version from_upload to consume.
|
||||
|
|
|
@ -142,10 +142,12 @@ class TestAddStaticThemeFromLwt(TestCase):
|
|||
application=amo.FIREFOX.id, version='53.0')
|
||||
AppVersion.objects.get_or_create(
|
||||
application=amo.FIREFOX.id, version='*')
|
||||
user_factory(id=settings.TASK_USER_ID, email='taskuser@mozilla.com')
|
||||
|
||||
def _mock_xpi_side_effect(self, lwt, upload_path):
|
||||
xpi_path = os.path.join(
|
||||
settings.ROOT, 'src/olympia/devhub/tests/addons/static_theme.zip')
|
||||
settings.ROOT,
|
||||
'src/olympia/devhub/tests/addons/mozilla_static_theme.zip')
|
||||
copy_stored_file(xpi_path, upload_path)
|
||||
assert not os.path.isdir(upload_path)
|
||||
return mock.DEFAULT
|
||||
|
@ -184,7 +186,8 @@ class TestAddStaticThemeFromLwt(TestCase):
|
|||
|
||||
def test_add_static_theme_from_lwt(self):
|
||||
author = user_factory()
|
||||
persona = addon_factory(type=amo.ADDON_PERSONA, users=[author])
|
||||
persona = addon_factory(
|
||||
type=amo.ADDON_PERSONA, users=[author], name='Firefox Theme')
|
||||
persona.update(
|
||||
created=self.create_date, modified=self.modify_date,
|
||||
last_updated=self.update_date)
|
||||
|
|
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче