Commit 07fd9edc authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui&test: return error if appcache file is not existed

parent ed8c62b5
......@@ -5,12 +5,12 @@ getDocumentValue = context.getDocumentValue
error_list = []
if appcache_reference:
appcache_manifest = getDocumentValue(appcache_reference)
if not appcache_manifest:
return ['Error: Web Site %s references a non existant appcache %s' % (context.getRelativeUrl(),appcache_reference)]
url_list = context.Base_getListFileFromAppcache()
# Check that the manifest is newer than all cached resources.
appcache_manifest = getDocumentValue(appcache_reference)
if appcache_manifest is not None:
appcache_manifest = appcache_manifest.getObject()
appcache_manifest_modification_date = appcache_manifest.getModificationDate()
appcache_manifest_modification_date = appcache_manifest.getObject().getModificationDate()
for url in url_list:
if url:
referenced_document = getDocumentValue(url)
......
......@@ -109,3 +109,13 @@ class TestRenderJSUpgrade(ERP5TypeTestCase):
manifest_content_list = manifest_content.split('\n')
self.assertIn(manifest_content_list[0] , self.manifest.getTextContent())
self.assertIn('\n'.join(manifest_content_list[2:]) , self.manifest.getTextContent())
def test_upgrade_site_with_non_existant_appcache(self):
non_existant_appcache = 'gw4wA4qA4T9^s*L3WD="k]'
self.web_site.setProperty(
'configuration_manifest_url', non_existant_appcache)
self.tic()
self.assertEqual(
[
'Error: Web Site %s references a non existant appcache %s' % (self.web_site.getRelativeUrl(), non_existant_appcache)
], [str(m.getMessage()) for m in self.web_site.checkConsistency()])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment