Fix bug 752046 because I'm already in here.

This commit is contained in:
Matt Basta 2012-10-15 17:34:05 -07:00
Родитель c60353bd80
Коммит 19bf92c01f
2 изменённых файлов: 9 добавлений и 5 удалений

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

@ -455,6 +455,7 @@ def failed_validation(*messages, **kwargs):
'prelim': True})
CT_URL = 'https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests'
def _fetch_manifest(url, upload=None):
def fail(message, upload=None):
if upload is None:
@ -474,7 +475,8 @@ def _fetch_manifest(url, upload=None):
ct = response.headers.get('Content-Type', '')
if not ct.startswith('application/x-web-app-manifest+json'):
fail(_('Manifests must be served with the HTTP header '
'"Content-Type: application/x-web-app-manifest+json".'),
'"Content-Type: application/x-web-app-manifest+json". See %s '
'for more information.') % CT_URL,
upload=upload)
try:

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

@ -344,8 +344,9 @@ class TestFetchManifest(amo.tests.TestCase):
tasks.fetch_manifest('url', self.upload.pk)
self.check_validation(
'Manifests must be served with the HTTP header '
'"Content-Type: application/x-web-app-manifest+json".')
'Manifests must be served with the HTTP header "Content-Type: '
'application/x-web-app-manifest+json". See %s for more '
'information.' % tasks.CT_URL)
@mock.patch('mkt.developers.tasks.validator', lambda uid, **kw: None)
def test_bad_content_type(self):
@ -354,8 +355,9 @@ class TestFetchManifest(amo.tests.TestCase):
tasks.fetch_manifest('url', self.upload.pk)
self.check_validation(
'Manifests must be served with the HTTP header '
'"Content-Type: application/x-web-app-manifest+json".')
'Manifests must be served with the HTTP header "Content-Type: '
'application/x-web-app-manifest+json". See %s for more '
'information.' % tasks.CT_URL)
@mock.patch('mkt.developers.tasks.validator', lambda uid, **kw: None)
def test_good_charset(self):