diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml
index df4b10947782..a05f9b0cebee 100644
--- a/.github/workflows/ci-tests.yml
+++ b/.github/workflows/ci-tests.yml
@@ -18,32 +18,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
-
- - name: Start DB
- run: |
- docker run --add-host host.docker.internal:host-gateway --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=verysecurepw -e MYSQL_DATABASE=test_olympia -d mysql:8.0 --default-authentication-plugin=mysql_native_password
- sleep 15
- docker exec mysql mysql -P 3306 -u root -p"verysecurepw" -e "CREATE USER 'root'@'127.0.0.1' IDENTIFIED WITH mysql_native_password BY 'verysecurepw';"
- docker exec mysql mysql -P 3306 -u root -p"verysecurepw" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1';"
-
- - name: Start ES
- run: docker run --add-host host.docker.internal:host-gateway --name es -p 9200:9200 -p 9300:9300 -e ES_NETWORK_HOST=0.0.0.0 -e discovery.type=single-node -d elasticsearch:5.6.12-alpine
-
- - name: Run docker container
- run: docker run --add-host host.docker.internal:host-gateway -it -d --name atn -e DATABASES_DEFAULT_URL=mysql://root:verysecurepw@host.docker.internal:3306/test_olympia -e ES_HOSTS=host.docker.internal:9200 -e ELASTICSEARCH_LOCATION=host.docker.internal:9200 -v $GITHUB_WORKSPACE/src:/data/olympia/src:rw thunderbirdops/addons-server bash
-
- - name: Install deps
- run: docker exec atn bash -c "make -f Makefile-docker update_deps"
-
- - name: Patch Django
- run: docker exec atn bash -c "sed -i 's/TX_ISOLATION = /transaction_isolation = /' /usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py"
-
- - name: Run tests
- run: docker exec atn bash -c 'python -m pytest --junitxml=src/test_report.xml -m "not es_tests" src/olympia/'
-
- - name: Publish test results
- uses: EnricoMi/publish-unit-test-result-action@v2
- if: always()
- with:
- files: src/test_report.xml
\ No newline at end of file
+ - uses: actions/checkout@v4
+
+ - name: Build Docker Compose
+ run: docker compose build
+
+ - name: Run Docker Compose
+ run: docker compose up -d
+
+ - name: Wait a bit for MySQL to boot
+ run: sleep 10
+
+ - name: Install deps
+ run: docker compose exec web bash -c "make -f Makefile-docker update_deps"
+
+ - name: Patch Django
+ run: docker compose exec web bash -c "sed -i 's/TX_ISOLATION = /transaction_isolation = /' /usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py"
+
+ - name: Run tests
+ run: docker compose exec web bash -c 'python -m pytest --junitxml=src/test_report36.xml -m "not es_tests" src/olympia/'
+
+ - name: Publish test results
+ uses: EnricoMi/publish-unit-test-result-action@v2
+ if: always()
+ with:
+ check_name: "Python 3.6 Test Results"
+ files: src/test_report36.xml
\ No newline at end of file
diff --git a/Dockerfile.python3 b/Dockerfile.python3
index 1dccc577c2fb..fb68b614063a 100644
--- a/Dockerfile.python3
+++ b/Dockerfile.python3
@@ -7,6 +7,9 @@ ENV PYTHON_VERSION_MAJOR 3
# Allow scripts to detect we're running in our own container
RUN touch /addons-server-docker-container
+# Update the main repositories to the archived repository
+RUN echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list
+
# Add nodesource repository and requirements
ADD docker/nodesource.gpg.key /etc/pki/gpg/GPG-KEY-nodesource
RUN apt-get update && apt-get install -y \
@@ -17,7 +20,9 @@ RUN cat /etc/pki/gpg/GPG-KEY-nodesource | apt-key add -
ADD docker/debian-stretch-nodesource-repo /etc/apt/sources.list.d/nodesource.list
ADD docker/debian-stretch-backports-repo /etc/apt/sources.list.d/backports.list
-RUN apt-get update && apt-get install -y \
+RUN apt-get update && apt-get install -y --allow-downgrades \
+ # Downgrades
+ libssl1.1=1.1.0l-1~deb9u1 \
# General (dev-) dependencies
bash-completion \
build-essential \
@@ -50,16 +55,16 @@ RUN apt-get update && apt-get install -y \
libmaxminddb-dev \
&& rm -rf /var/lib/apt/lists/*
-RUN apt-get update && apt-get -t stretch-backports install -y \
- # For git-based files storage backend
- libgit2-dev \
- && rm -rf /var/lib/apt/lists/*
+#RUN apt-get update && apt-get -t stretch-backports install -y \
+# # For git-based files storage backend
+# libgit2-dev \
+# && rm -rf /var/lib/apt/lists/*
-ADD http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz /tmp
+#ADD http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz /tmp
-RUN mkdir -p /usr/local/share/GeoIP \
- && gunzip -c /tmp/GeoLite2-Country.mmdb.gz > /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
- && rm -f /tmp/GeoLite2-Country.mmdb.gz
+#RUN mkdir -p /usr/local/share/GeoIP \
+# && gunzip -c /tmp/GeoLite2-Country.mmdb.gz > /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
+# && rm -f /tmp/GeoLite2-Country.mmdb.gz
# Compile required locale
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
@@ -100,3 +105,4 @@ ENV CLEANCSS_BIN /deps/node_modules/.bin/cleancss
ENV LESS_BIN /deps/node_modules/.bin/lessc
ENV UGLIFY_BIN /deps/node_modules/.bin/uglifyjs
ENV ADDONS_LINTER_BIN /deps/node_modules/.bin/addons-linter
+RUN npm cache clean -f && npm install -g n && /deps/bin/n 16
\ No newline at end of file
diff --git a/Makefile-docker b/Makefile-docker
index 871781a52019..d63a824f5919 100644
--- a/Makefile-docker
+++ b/Makefile-docker
@@ -97,10 +97,10 @@ populate_data:
# reindex --wipe will force the ES mapping to be re-installed. Useful to
# make sure the mapping is correct before adding a bunch of add-ons.
$(PYTHON_COMMAND) manage.py reindex --wipe --force --noinput
- $(PYTHON_COMMAND) manage.py generate_addons --app firefox $(NUM_ADDONS)
- $(PYTHON_COMMAND) manage.py generate_addons --app android $(NUM_ADDONS)
+ #$(PYTHON_COMMAND) manage.py generate_addons --app firefox $(NUM_ADDONS)
+ #$(PYTHON_COMMAND) manage.py generate_addons --app android $(NUM_ADDONS)
$(PYTHON_COMMAND) manage.py generate_addons --app thunderbird $(NUM_ADDONS)
- $(PYTHON_COMMAND) manage.py generate_themes --app firefox $(NUM_THEMES)
+ #$(PYTHON_COMMAND) manage.py generate_themes --app firefox $(NUM_THEMES)
$(PYTHON_COMMAND) manage.py generate_themes --app thunderbird $(NUM_THEMES)
# These add-ons are specifically useful for the addons-frontend
# homepage. You may have to re-run this, in case the data there
diff --git a/UPGRADE_STATUS.md b/UPGRADE_STATUS.md
new file mode 100644
index 000000000000..0946c4f3869e
--- /dev/null
+++ b/UPGRADE_STATUS.md
@@ -0,0 +1,3 @@
+# Upgrade Status
+
+ATN is currently rebased onto AMO tag 2019.02.28
\ No newline at end of file
diff --git a/docker-compose.mac-arm.yml b/docker-compose.mac-arm.yml
deleted file mode 100644
index 96b2bd3d8a73..000000000000
--- a/docker-compose.mac-arm.yml
+++ /dev/null
@@ -1,114 +0,0 @@
-version: "2.3"
-
-x-env-mapping: &env
- environment:
- - CELERY_BROKER_URL=amqp://olympia:olympia@rabbitmq/olympia
- - CELERY_RESULT_BACKEND=redis://redis:6379/1
- - DATABASES_DEFAULT_URL=mysql://root:@mysqld/olympia
- - ELASTICSEARCH_LOCATION=elasticsearch:9200
- - MEMCACHE_LOCATION=memcached:11211
- - MYSQL_DATABASE=olympia
- - MYSQL_ROOT_PASSWORD=docker
- - OLYMPIA_SITE_URL=http://olympia.test
- - PYTHONDONTWRITEBYTECODE=1
- - PYTHONUNBUFFERED=1
- - RECURSION_LIMIT=10000
- - TERM=xterm-256color
-
-services:
- worker: &worker
- <<: *env
- image: addons/addons-server
- command: supervisord -n -c /code/docker/supervisor-celery.conf
- entrypoint: ./scripts/start-docker.sh
- volumes:
- - .:/code
- extra_hosts:
- - "olympia.test:127.0.0.1"
-
- web:
- <<: *worker
- command: supervisord -n -c /code/docker/supervisor.conf
-
- web-tests:
- <<: *worker
- tty: true
-
- nginx:
- image: addons/addons-nginx
- volumes:
- - ./static:/srv/static
- - ./site-static:/srv/site-static
- - ./user-media/:/srv/user-media
-
- memcached:
- image: memcached:1.4
-
- mysqld:
- image: mysql:5.7
- platform: "linux/amd64"
- environment:
- - MYSQL_ALLOW_EMPTY_PASSWORD=yes
- - MYSQL_DATABASE=olympia
-
- elasticsearch:
- image: docker.elastic.co/elasticsearch/elasticsearch:5.4.1
- platform: "linux/amd64"
- environment:
- # Disable all xpack related features to avoid unrelated logging
- # in docker logs. https://github.com/mozilla/addons-server/issues/8887
- # This also avoids us to require authentication for local development
- # which simplifies the setup.
- - xpack.security.enabled=false
- - xpack.monitoring.enabled=false
- - xpack.graph.enabled=false
- - xpack.watcher.enabled=false
- - "discovery.type=single-node"
- - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- # M1 mac emulation doesn't support this feature
- - bootstrap.system_call_filter=false
- mem_limit: 2g
-
- redis:
- image: redis:latest #:2.8
-
- rabbitmq:
- image: rabbitmq:3.8 #:3.5
- hostname: olympia
- expose:
- - "5672"
- environment:
- - RABBITMQ_DEFAULT_USER=olympia
- - RABBITMQ_DEFAULT_PASS=olympia
- - RABBITMQ_DEFAULT_VHOST=olympia
-
- autograph:
- image: mozilla/autograph:2.3.0
-
- selenium-firefox:
- <<: *env
- image: b4handjr/selenium-firefox
- volumes:
- - .:/code
- expose:
- - "4444"
- ports:
- - "5900"
- shm_size: 2g
- links:
- - "addons-frontend:olympia-frontend.test"
- - "nginx:olympia.test"
-
- addons-frontend:
- <<: *env
- environment:
- - HOSTNAME=uitests
- - WEBPACK_SERVER_HOST=olympia-frontend.test
- - FXA_CONFIG=default
- image: addons/addons-frontend
- ports:
- - "3000:3000"
- - "3001:3001"
- command: yarn amo:ui-tests
- links:
- - "nginx:olympia.test"
diff --git a/docker-compose.override.yml b/docker-compose.override.yml
index 194d80bc6ad4..b6e44cb0c597 100644
--- a/docker-compose.override.yml
+++ b/docker-compose.override.yml
@@ -1,9 +1,7 @@
-version: "2.3"
-
services:
- nginx:
- ports:
- - "80:80"
+# nginx:
+# ports:
+# - "80:80"
web:
ports:
diff --git a/docker-compose.yml b/docker-compose.yml
index 7cfaf936cc2a..0d2926e6bce9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,3 @@
-version: "2.3"
-
# If you're changing the &env mapping
# please make sure to update tests/ui/docker-compose.selenium.yml
# accordingly.
@@ -20,7 +18,10 @@ x-env-mapping: &env
services:
worker: &worker
<<: *env
- image: addons/addons-server:latest-py3
+ #image: addons/addons-server:latest-py3
+ build:
+ context: .
+ dockerfile: Dockerfile.python3
command: supervisord -n -c /code/docker/supervisor-celery.conf
entrypoint: ./scripts/start-docker.sh
volumes:
@@ -32,19 +33,24 @@ services:
<<: *worker
command: supervisord -n -c /code/docker/supervisor.conf
- nginx:
- image: addons/addons-nginx
- volumes:
- - ./static:/srv/static
- - ./site-static:/srv/site-static
- - ./storage/shared_storage/uploads:/srv/user-media
- - ./storage/files:/srv/user-media/addons
+# nginx:
+# image: addons/addons-nginx
+# volumes:
+# - ./static:/srv/static
+# - ./site-static:/srv/site-static
+# - ./storage/shared_storage/uploads:/srv/user-media
+# - ./storage/files:/srv/user-media/addons
memcached:
image: memcached:1.4
mysqld:
image: mysql:5.7
+ ulimits:
+ nproc: 65535
+ nofile:
+ soft: 20000
+ hard: 40000
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=olympia
@@ -62,13 +68,18 @@ services:
- xpack.watcher.enabled=false
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+ ulimits:
+ nproc: 65535
+ nofile:
+ soft: 20000
+ hard: 40000
mem_limit: 2g
redis:
image: redis:2.8
rabbitmq:
- image: rabbitmq:3.5
+ image: rabbitmq:3
hostname: olympia
expose:
- "5672"
@@ -77,19 +88,20 @@ services:
- RABBITMQ_DEFAULT_PASS=olympia
- RABBITMQ_DEFAULT_VHOST=olympia
+# ATN Doesn't sign addons, but we need it for tests
autograph:
image: mozilla/autograph:2.7.0
- addons-frontend:
- <<: *env
- environment:
- - HOSTNAME=uitests
- - WEBPACK_SERVER_HOST=olympia-frontend.test
- - FXA_CONFIG=default
- image: addons/addons-frontend
- ports:
- - "3000:3000"
- - "3001:3001"
- command: yarn amo:ui-tests
- links:
- - "nginx:olympia.test"
+# addons-frontend:
+# <<: *env
+# environment:
+# - HOSTNAME=uitests
+# - WEBPACK_SERVER_HOST=olympia-frontend.test
+# - FXA_CONFIG=default
+# image: addons/addons-frontend
+# ports:
+# - "3000:3000"
+# - "3001:3001"
+# command: yarn amo:ui-tests
+# links:
+# - "nginx:olympia.test"
diff --git a/requirements/prod_common.txt b/requirements/prod_common.txt
index 708aa158f4fe..f7a63af7a70b 100644
--- a/requirements/prod_common.txt
+++ b/requirements/prod_common.txt
@@ -265,33 +265,8 @@ kombu==4.3.0 \
--hash=sha256:7a2cbed551103db9a4e2efafe9b63222e012a61a18a881160ad797b9d4e1d0a1 \
--hash=sha256:529df9e0ecc0bad9fc2b376c3ce4796c41b482cf697b78b71aea6ebe7ca353c8
# lxml is required by pyquery
-lxml==4.3.1 \
- --hash=sha256:1c630c083d782cbaf1f7f37f6cac87bda9cff643cf2803a5f180f30d97955cef \
- --hash=sha256:983129f3fd3cef5c3cf067adcca56e30a169656c00fcc6c648629dbb850b27fa \
- --hash=sha256:95b392952935947e0786a90b75cc33388549dcb19af716b525dae65b186138fc \
- --hash=sha256:b5db89cc0ef624f3a81214b7961a99f443b8c91e88188376b6b322fd10d5b118 \
- --hash=sha256:47d8365a8ef14097aa4c65730689be51851b4ade677285a3b2daa03b37893e26 \
- --hash=sha256:9563a23c1456c0ab550c087833bc13fcc61013a66c6420921d5b70550ea312bf \
- --hash=sha256:0537eee4902e8bf4f41bfee8133f7edf96533dd175930a12086d6a40d62376b2 \
- --hash=sha256:7940d5c2185ffb989203dacbb28e6ae88b4f1bb25d04e17f94b0edd82232bcbd \
- --hash=sha256:d4d63d85eacc6cb37b459b16061e1f100d154bee89dc8d8f9a6128a5a538e92e \
- --hash=sha256:dccad2b3c583f036f43f80ac99ee212c2fa9a45151358d55f13004d095e683b2 \
- --hash=sha256:c0c5a7d4aafcc30c9b6d8613a362567e32e5f5b708dc41bc3a81dac56f8af8bb \
- --hash=sha256:7cf39bb3a905579836f7a8f3a45320d9eb22f16ab0c1e112efb940ced4d057a5 \
- --hash=sha256:510e904079bc56ea784677348e151e1156040dbfb736f1d8ea4b9e6d0ab2d9f4 \
- --hash=sha256:1ae4c0722fc70c0d4fba43ae33c2885f705e96dce1db41f75ae14a2d2749b428 \
- --hash=sha256:09e91831e749fbf0f24608694e4573be0ef51430229450c39c83176cc2e2d353 \
- --hash=sha256:a0b75b1f1854771844c647c464533def3e0a899dd094a85d1d4ed72ecaaee93d \
- --hash=sha256:df46307d39f2aeaafa1d25309b8a8d11738b73e9861f72d4d0a092528f498baa \
- --hash=sha256:0562ec748abd230ab87d73384e08fa784f9b9cee89e28696087d2d22c052cc27 \
- --hash=sha256:ea825562b8cd057cbc9810d496b8b5dec37a1e2fc7b27bc7c1e72ce94462a09a \
- --hash=sha256:2fe74e3836bd8c0fa7467ffae05545233c7f37de1eb765cacfda15ad20c6574a \
- --hash=sha256:3f2d9eafbb0b24a33f56acd16f39fc935756524dcb3172892721c54713964c70 \
- --hash=sha256:e70b5e1cb48828ddd2818f99b1662cb9226dc6f57d07fc75485405c77da17436 \
- --hash=sha256:c0a7751ba1a4bfbe7831920d98cee3ce748007eab8dfda74593d44079568219a \
- --hash=sha256:37af783c2667ead34a811037bda56a0b142ac8438f7ed29ae93f82ddb812fbd6 \
- --hash=sha256:58d0851da422bba31c7f652a7e9335313cf94a641aa6d73b8f3c67602f75b593 \
- --hash=sha256:da5e7e941d6e71c9c9a717c93725cda0708c2474f532e3680ac5e39ec57d224d
+lxml==4.3.2 \
+ --hash=sha256:4888be27d5cba55ce94209baef5bcd7bbd7314a3d17021a5fc10000b3a5f737d
# m2secret is required by django-aesfield
m2secret-py3==1.3 \
--hash=sha256:94dfae937e8a61bf48812fab6a0b8de300781c4e1dbee0cee3aa57cb01915864
diff --git a/settings.py b/settings.py
index 82f145f8d285..8a4a66643e81 100644
--- a/settings.py
+++ b/settings.py
@@ -12,6 +12,7 @@
WSGI_APPLICATION = 'olympia.wsgi.application'
DEBUG = True
+DEV_BYPASS_AUTH = True
# These apps are great during development.
INSTALLED_APPS += (
diff --git a/settings_test.py b/settings_test.py
index c14d94548cbb..4791d0149cfe 100644
--- a/settings_test.py
+++ b/settings_test.py
@@ -11,6 +11,7 @@
# See settings.py for documentation:
IN_TEST_SUITE = True
+DEFAULT_APP = 'firefox'
# Don't call out to persona in tests.
AUTHENTICATION_BACKENDS = (
diff --git a/src/olympia/accounts/utils.py b/src/olympia/accounts/utils.py
index a6e642d6b385..850ea050cf0b 100644
--- a/src/olympia/accounts/utils.py
+++ b/src/olympia/accounts/utils.py
@@ -14,6 +14,7 @@
from six.moves.urllib_parse import urlencode
from olympia.accounts.tasks import primary_email_change_event
+from olympia.amo.utils import dev_bypass_auth
from olympia.core.logger import getLogger
@@ -59,6 +60,9 @@ def default_fxa_register_url(request):
def default_fxa_login_url(request):
+ if dev_bypass_auth():
+ return '/api/v3/accounts/login/start/'
+
request.session.setdefault('fxa_state', generate_fxa_state())
return fxa_login_url(
config=settings.FXA_CONFIG['default'],
diff --git a/src/olympia/accounts/views.py b/src/olympia/accounts/views.py
index 75555902a4d0..5adccac36eb5 100644
--- a/src/olympia/accounts/views.py
+++ b/src/olympia/accounts/views.py
@@ -39,7 +39,7 @@
from olympia.access.models import GroupUser
from olympia.amo import messages
from olympia.amo.decorators import use_primary_db
-from olympia.amo.utils import fetch_subscribed_newsletters
+from olympia.amo.utils import fetch_subscribed_newsletters, dev_bypass_auth
from olympia.api.authentication import (
JWTKeyAuthentication, WebTokenAuthentication)
from olympia.api.permissions import AnyOf, ByHttpMethod, GroupPermission
@@ -336,6 +336,16 @@ def get_fxa_config(self, request):
class LoginStartBaseView(FxAConfigMixin, APIView):
def get(self, request):
+ if dev_bypass_auth():
+ # Dev work-around for local auth
+ user = UserProfile.objects.first()
+ identity = {
+ 'uid': '1234',
+ 'email': user.email,
+ }
+ login_user(self.__class__, request, user, identity)
+ return HttpResponseRedirect('/')
+
request.session.setdefault('fxa_state', generate_fxa_state())
return HttpResponseRedirect(
fxa_login_url(
diff --git a/src/olympia/activity/models.py b/src/olympia/activity/models.py
index 76c3d4d87ceb..13b2ce41eb3f 100644
--- a/src/olympia/activity/models.py
+++ b/src/olympia/activity/models.py
@@ -375,14 +375,17 @@ def arguments_builder(cls, activities):
# that each particular log has, in the correct order.
for activity in activities:
objs = []
- for item in d:
- # item has only one element.
- model_name, pk = list(item.items())[0]
- if model_name in ('str', 'int', 'null'):
- objs.append(pk)
- elif pk:
- # Fetch the instance from the cache we built.
- objs.append(instances[name].get(int(pk)))
+ # We preloaded that property earlier
+ for item in activity.arguments_data:
+ # As above, each 'item' should have one key and one value only.
+ name, pk = list(item.items())[0]
+ if name in ('str', 'int', 'null'):
+ # It's not actually a model reference, just return the
+ # value directly.
+ objs.append(pk)
+ elif pk:
+ # Fetch the instance from the cache we built.
+ objs.append(instances[name].get(int(pk)))
# Override the arguments cached_property with what we got.
activity.arguments = objs
diff --git a/src/olympia/addons/models.py b/src/olympia/addons/models.py
index d0645843d996..4f175d7f1f62 100644
--- a/src/olympia/addons/models.py
+++ b/src/olympia/addons/models.py
@@ -484,13 +484,13 @@ def _prepare_deletion_email(self, msg, reason):
return subject, email_msg
@transaction.atomic
- def delete(self, msg='', reason='', send_delete_email=True):
+ def delete(self, msg='', reason='', send_delete_email=True, hard=False):
# To avoid a circular import
from . import tasks
from olympia.versions import tasks as version_tasks
# Check for soft deletion path. Happens only if the addon status isn't
# 0 (STATUS_INCOMPLETE) with no versions.
- soft_deletion = self.is_soft_deleteable()
+ soft_deletion = self.is_soft_deleteable() and not hard
if soft_deletion and self.status == amo.STATUS_DELETED:
# We're already done.
return
diff --git a/src/olympia/addons/tasks.py b/src/olympia/addons/tasks.py
index 2977106c3123..7694d4c9d61b 100644
--- a/src/olympia/addons/tasks.py
+++ b/src/olympia/addons/tasks.py
@@ -50,7 +50,7 @@
from olympia.translations.models import Translation
from olympia.users.models import UserProfile
from olympia.versions.models import (
- generate_static_theme_preview, License, Version, VersionPreview)
+ generate_static_theme_preview, License, Version, VersionPreview, ApplicationsVersions)
log = olympia.core.logger.getLogger('z.task')
@@ -761,7 +761,7 @@ def delete_addon_not_compatible_with_thunderbird(ids, **kw):
@task
@use_primary_db
-def output_personas(ids, **kw):
+def output_personas(ids, filename = 'personas.csv', **kw):
"""
Output the specified add-ons.
Used by process_addons --task=output_personas
@@ -770,7 +770,7 @@ def output_personas(ids, **kw):
'Outputting personas %d-%d [%d].',
ids[0], ids[-1], len(ids))
qs = Addon.objects.filter(pk__in=ids)
- persona_csv = csv.writer(open('personas.csv', 'ab'))
+ persona_csv = csv.writer(open(filename, 'ab'))
for addon in qs:
persona_csv.writerow([addon.id, addon.name, addon.get_detail_url()])
@@ -858,7 +858,7 @@ def migrate_legacy_dictionary_to_webextension(addon):
# Sign the file, and set it to public. That should automatically set
# current_version to the version we created.
file_ = version.all_files[0]
- sign_file(file_)
+ #sign_file(file_)
file_.update(datestatuschanged=now, reviewed=now, status=amo.STATUS_PUBLIC)
diff --git a/src/olympia/addons/tests/test_commands.py b/src/olympia/addons/tests/test_commands.py
index d2091f0be9fd..5e5f0f51f3ec 100644
--- a/src/olympia/addons/tests/test_commands.py
+++ b/src/olympia/addons/tests/test_commands.py
@@ -606,7 +606,7 @@ def create_addon(version, alt_version = None, min = None, max = None):
pa.delete_addon_not_compatible_with_thunderbird) as calls:
self.make_the_call()
- bad_addons_pk = map(lambda a: a.pk, bad_addons)
+ bad_addons_pk = list(map(lambda a: a.pk, bad_addons))
assert len(calls) == 1
assert calls[0]['kwargs']['args'] == [bad_addons_pk]
@@ -734,8 +734,8 @@ def create_addon(version, extension_type = amo.ADDON_PERSONA, alt_version = None
with count_subtask_calls(pa.delete_personas) as calls:
self.make_the_call()
- personas_pk = map(lambda a: a.pk, personas)
- personas_object_pk = map(lambda a: a.persona.pk, personas)
+ personas_pk = list(map(lambda a: a.pk, personas))
+ personas_object_pk = list(map(lambda a: a.persona.pk, personas))
assert len(calls) == 1
assert calls[0]['kwargs']['args'] == [personas_pk]
@@ -764,7 +764,7 @@ def create_addon(version, extension_type = amo.ADDON_PERSONA, alt_version = None
class TestOutputPersonas(TestCase):
def make_the_call(self):
call_command('process_addons',
- task='output_personas')
+ task='output_personas', filename='/tmp/personas.csv')
def test_basic(self):
def create_addon(version):
@@ -776,7 +776,7 @@ def create_addon(version):
personas = []
- file_name = 'personas.csv'
+ file_name = '/tmp/personas.csv'
# Nuke the file
with open(file_name, 'wb') as fh:
diff --git a/src/olympia/addons/tests/test_indexers.py b/src/olympia/addons/tests/test_indexers.py
index 7051f82baadd..7ab80d292176 100644
--- a/src/olympia/addons/tests/test_indexers.py
+++ b/src/olympia/addons/tests/test_indexers.py
@@ -26,8 +26,8 @@ class TestAddonIndexer(TestCase):
'average_daily_users', 'bayesian_rating', 'contributions', 'created',
'default_locale', 'guid', 'hotness', 'icon_hash', 'icon_type', 'id',
'is_disabled', 'is_experimental', 'last_updated', 'modified',
- 'public_stats', 'requires_payment', 'slug', 'status', 'type',
- 'view_source', 'weekly_downloads',
+ 'public_stats', 'requires_payment', 'requires_sensitive_data_access',
+ 'slug', 'status', 'type', 'view_source', 'weekly_downloads',
]
def setUp(self):
@@ -455,6 +455,14 @@ def test_extract_persona(self):
'min': 11000000200100,
'min_human': '11.0',
},
+ amo.THUNDERBIRD.id: {'max': 9999000000200100,
+ 'max_human': '9999',
+ 'min': 1000000200100,
+ 'min_human': '1.0'},
+ amo.SEAMONKEY.id: {'max': 9999000000200100,
+ 'max_human': '9999',
+ 'min': 1000000200100,
+ 'min_human': '1.0'},
amo.FIREFOX.id: {
'max': 9999000000200100,
'max_human': '9999',
diff --git a/src/olympia/addons/tests/test_models.py b/src/olympia/addons/tests/test_models.py
index 7ee316cdac56..a20e0b13e210 100644
--- a/src/olympia/addons/tests/test_models.py
+++ b/src/olympia/addons/tests/test_models.py
@@ -565,7 +565,7 @@ def _delete(self, addon_id):
def test_delete(self):
addon = Addon.unfiltered.get(pk=3615)
- addon.name = u'é' # Make sure we don't have encoding issues.
+ addon.name = 'é' # Make sure we don't have encoding issues.
addon.save()
self._delete(3615)
@@ -575,7 +575,7 @@ def test_delete(self):
def test_delete_persona(self):
addon = amo.tests.addon_factory(type=amo.ADDON_PERSONA)
- assert addon.guid is None # Personas don't have GUIDs.
+ #assert addon.guid is None # Personas don't have GUIDs.
self._delete(addon.pk)
@patch('olympia.addons.tasks.Preview.delete_preview_files')
diff --git a/src/olympia/addons/tests/test_serializers.py b/src/olympia/addons/tests/test_serializers.py
index 0cbaa26b95d7..8127deeb78e0 100644
--- a/src/olympia/addons/tests/test_serializers.py
+++ b/src/olympia/addons/tests/test_serializers.py
@@ -594,6 +594,7 @@ def test_special_compatibility_cases(self):
assert result_version['compatibility'] == {
'android': {'max': '9999', 'min': '11.0'},
'firefox': {'max': '9999', 'min': '4.0'},
+ 'seamonkey': {'max': '9999', 'min': '1.0'},
}
assert result_version['is_strict_compatibility_enabled'] is False
diff --git a/src/olympia/addons/tests/test_tasks.py b/src/olympia/addons/tests/test_tasks.py
index 6a2f56d1075a..52a380bfe50a 100644
--- a/src/olympia/addons/tests/test_tasks.py
+++ b/src/olympia/addons/tests/test_tasks.py
@@ -227,7 +227,7 @@ def test_add_static_theme_from_lwt(self):
author = user_factory()
persona = addon_factory(
- type=amo.ADDON_PERSONA, users=[author], name='Firefox Theme')
+ guid='test@example.org', type=amo.ADDON_PERSONA, users=[author], name='Firefox Theme')
persona.update(
created=self.create_date, modified=self.modify_date,
last_updated=self.update_date)
diff --git a/src/olympia/addons/tests/test_update.py b/src/olympia/addons/tests/test_update.py
index b1064f567d86..b260aa33a340 100644
--- a/src/olympia/addons/tests/test_update.py
+++ b/src/olympia/addons/tests/test_update.py
@@ -748,6 +748,8 @@ def test_seamonkey_serve_rdf(self):
}
instance = self.get_update_instance(data)
result = instance.get_output()
+ print(result)
+ assert len(instance.data['row']) > 0, instance.data
assert instance.data['row']['hash'].startswith('sha256:9d9a389')
assert instance.data['row']['min'] == '1.0'
assert instance.data['row']['version'] == '0.5.2'
diff --git a/src/olympia/addons/tests/test_utils_.py b/src/olympia/addons/tests/test_utils_.py
index 1740c62d6ce5..ea7ebf3887a9 100644
--- a/src/olympia/addons/tests/test_utils_.py
+++ b/src/olympia/addons/tests/test_utils_.py
@@ -298,8 +298,8 @@ def test_lwt_missing_info(self):
lwt = addon_factory(
type=amo.ADDON_PERSONA, persona_id=0)
lwt.update(name='')
- # Give it a background header file with multiple dots.
- lwt.persona.header = 'weta......png'
+ # Give it a background header file.
+ lwt.persona.header = 'weta.png'
lwt.persona.header_path = self.background_png # It's a cached_property
static_xpi = tempfile.NamedTemporaryFile(suffix='.xpi').name
diff --git a/src/olympia/addons/tests/test_views.py b/src/olympia/addons/tests/test_views.py
index 999f829497ad..c63f5a141bff 100644
--- a/src/olympia/addons/tests/test_views.py
+++ b/src/olympia/addons/tests/test_views.py
@@ -362,35 +362,40 @@ def test_anonymous_extension(self):
assert response.context['addon'].id == 3615
def test_anonymous_persona(self):
+ """ATN doesn't support personas, so this should be a 410"""
response = self.client.get(reverse('addons.detail', args=['a15663']))
- assert response.status_code == 200
- assert response.context['addon'].id == 15663
+ assert response.status_code == 410
def test_broken_persona(self):
+ """ATN doesn't support personas, so this should be a 410"""
persona = Persona.objects.get(addon_id=15663)
persona.delete()
response = self.client.get(reverse('addons.detail', args=['a15663']))
- assert response.status_code == 404
+ assert response.status_code == 410
def test_review_microdata_personas(self):
+ """ATN doesn't support personas, so this should be a 410"""
addon = Addon.objects.get(id=15663)
addon.name = ''
addon.save()
response = self.client.get(reverse('addons.detail', args=['a15663']))
- assert (
- b'<script>alert("fff")</script>' in
- response.content)
- assert b'