workaround Response._headers going away; enable amo-lib-locales-and-signing job for 3.2 (#16471)

This commit is contained in:
Andrew Williamson 2021-02-05 10:05:26 +00:00 коммит произвёл GitHub
Родитель 47b8488c15
Коммит 4e12e60380
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 18 добавлений и 20 удалений

Просмотреть файл

@ -661,39 +661,39 @@ workflows:
parameters: parameters:
djangoversion: djangoversion:
- django22 - django22
# - django32 # django3.2 tests still failing - django32
- assets: - assets:
matrix: matrix:
parameters: parameters:
djangoversion: djangoversion:
- django22 - django22
- django32 - django32
- codestyle - codestyle
- devhub: - devhub:
matrix: matrix:
parameters: parameters:
djangoversion: djangoversion:
- django22 - django22
# - django32 # django3.2 tests still failing # - django32 # django3.2 tests still failing
- docs - docs
- main: - main:
matrix: matrix:
parameters: parameters:
djangoversion: djangoversion:
- django22 - django22
# - django32 # django3.2 tests still failing # - django32 # django3.2 tests still failing
- reviewers-and-zadmin: - reviewers-and-zadmin:
matrix: matrix:
parameters: parameters:
djangoversion: djangoversion:
- django22 - django22
- django32 - django32
- es-tests: - es-tests:
matrix: matrix:
parameters: parameters:
djangoversion: djangoversion:
- django22 - django22
# - django32 # django3.2 tests still failing # - django32 # django3.2 tests still failing
- release-master: - release-master:
filters: filters:
branches: branches:

Просмотреть файл

@ -8,7 +8,7 @@ from django.core.validators import ValidationError
from unittest import mock from unittest import mock
import pytest import pytest
from olympia.amo.tests import DQUOTE_ESCAPED, TestCase from olympia.amo.tests import TestCase
from olympia.amo.utils import ( from olympia.amo.utils import (
LocalFileStorage, LocalFileStorage,
cache_ns_key, cache_ns_key,
@ -278,7 +278,7 @@ def test_no_jinja_autoescape():
tpl = '{{ val }}' tpl = '{{ val }}'
ctx = {'val': val} ctx = {'val': val}
template = from_string(tpl) template = from_string(tpl)
assert template.render(ctx) == f'some double quote: {DQUOTE_ESCAPED} and a <' assert template.render(ctx) == 'some double quote: " and a <'
with no_jinja_autoescape(): with no_jinja_autoescape():
template = from_string(tpl) template = from_string(tpl)
assert template.render(ctx) == 'some double quote: " and a <' assert template.render(ctx) == 'some double quote: " and a <'

Просмотреть файл

@ -11,7 +11,6 @@ from django import test
from django.conf import settings from django.conf import settings
from django.test.client import RequestFactory from django.test.client import RequestFactory
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.encoding import force_str
import pytest import pytest
@ -341,12 +340,11 @@ class TestOtherStuff(TestCase):
def test_opensearch(self): def test_opensearch(self):
client = test.Client() client = test.Client()
page = client.get('/en-US/firefox/opensearch.xml') result = client.get('/en-US/firefox/opensearch.xml')
wanted = ('Content-Type', 'text/xml') assert result.get('Content-Type') == 'text/xml'
assert page._headers['content-type'] == wanted
doc = etree.fromstring(page.content) doc = etree.fromstring(result.content)
e = doc.find('{http://a9.com/-/spec/opensearch/1.1/}ShortName') e = doc.find('{http://a9.com/-/spec/opensearch/1.1/}ShortName')
assert e.text == 'Firefox Add-ons' assert e.text == 'Firefox Add-ons'
@ -391,9 +389,9 @@ class TestCORS(TestCase):
class TestContribute(TestCase): class TestContribute(TestCase):
def test_contribute_json(self): def test_contribute_json(self):
res = self.client.get('/contribute.json') result = self.client.get('/contribute.json')
assert res.status_code == 200 assert result.status_code == 200
assert res._headers['content-type'] == ('Content-Type', 'application/json') assert result.get('Content-Type') == 'application/json'
class TestRobots(TestCase): class TestRobots(TestCase):
@ -492,10 +490,10 @@ class TestAtomicRequests(WithDynamicEndpointsAndTransactions):
class TestVersion(TestCase): class TestVersion(TestCase):
def test_version_json(self): def test_version_json(self):
res = self.client.get('/__version__') result = self.client.get('/__version__')
assert res.status_code == 200 assert result.status_code == 200
assert res._headers['content-type'] == ('Content-Type', 'application/json') assert result.get('Content-Type') == 'application/json'
content = json.loads(force_str(res.content)) content = result.json()
assert content['python'] == '%s.%s' % ( assert content['python'] == '%s.%s' % (
sys.version_info.major, sys.version_info.major,
sys.version_info.minor, sys.version_info.minor,