Exclude vendor JS in mozmarket when necessary
This commit is contained in:
Родитель
fad2e86bbc
Коммит
662523f077
|
@ -1455,3 +1455,8 @@ IN_TEST_SUITE = False
|
|||
# Until bug 753421 gets fixed, we're skipping ES tests. Sad times. I know.
|
||||
# Flip this on in your local settings to experience the joy of ES tests.
|
||||
RUN_ES_TESTS = False
|
||||
|
||||
# All JS vendor libraries in this list will be excluded from mozmarket.js.
|
||||
# For example, if receiptverifier is broken and you need to disable it, add
|
||||
# 'receiptverifier' to the list. See also mkt/site/views.py.
|
||||
MOZMARKET_VENDOR_EXCLUDE = ['receiptverifier']
|
||||
|
|
|
@ -83,6 +83,12 @@ class TestMozmarketJS(amo.tests.TestCase):
|
|||
resp = self.render()
|
||||
self.assertContains(resp, 'exports.receipts.Verifier')
|
||||
|
||||
@mock.patch.object(settings, 'MOZMARKET_VENDOR_EXCLUDE',
|
||||
['receiptverifier'])
|
||||
def test_exclude(self):
|
||||
resp = self.render()
|
||||
self.assertNotContains(resp, 'exports.receipts.Verifier')
|
||||
|
||||
|
||||
class TestRobots(amo.tests.TestCase):
|
||||
|
||||
|
|
|
@ -94,9 +94,13 @@ def record(request):
|
|||
@cache_page(60 * 60)
|
||||
@no_login_required
|
||||
def mozmarket_js(request):
|
||||
with open(os.path.join(settings.ROOT, 'vendor', 'js',
|
||||
'receiptverifier',
|
||||
'receiptverifier.js'), 'r') as fp:
|
||||
vendor_js = [('receiptverifier', fp.read())]
|
||||
vendor_js = []
|
||||
for lib, path in (('receiptverifier',
|
||||
'receiptverifier/receiptverifier.js'),):
|
||||
if lib in settings.MOZMARKET_VENDOR_EXCLUDE:
|
||||
continue
|
||||
with open(os.path.join(settings.ROOT,
|
||||
'vendor', 'js', path), 'r') as fp:
|
||||
vendor_js.append((lib, fp.read()))
|
||||
return jingo.render(request, 'site/mozmarket.js', {'vendor_js': vendor_js},
|
||||
content_type='text/javascript')
|
||||
|
|
|
@ -90,3 +90,5 @@ DEBUG_TOOLBAR_CONFIG = {
|
|||
'TAG': 'div',
|
||||
'ENABLE_STACKTRACES' : False,
|
||||
}
|
||||
|
||||
MOZMARKET_VENDOR_EXCLUDE = []
|
||||
|
|
Загрузка…
Ссылка в новой задаче