Commit f25e40d6 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Jérome Perrin

erp5_web_renderjs_ui&test: first line of Appcache file should be CACHE MANIFEST

parent 99c7ec1d
......@@ -19,9 +19,10 @@ if appcache_reference:
"Document {} is newer than cache manifest".format(url))
if error_list and fixit:
text_list = appcache_manifest.getTextContent().split('\n')
assert text_list[0] == 'CACHE MANIFEST', 'First Line of %s should be CACHE MANIFEST' % appcache_manifest.getRelativeUrl()
appcache_manifest.edit(
text_content='''# Last modified by {} on {}
{}
'''.format(script.getId(), DateTime(), appcache_manifest.getTextContent()))
text_content='''{}
# Last modified by {} on {}
{}'''.format(text_list[0], script.getId(), DateTime(), '\n'.join(text_list[1:])))
return error_list
......@@ -102,7 +102,10 @@ class TestRenderJSUpgrade(ERP5TypeTestCase):
self.assertGreater(
self.manifest.getModificationDate(),
self.javascript.getModificationDate())
# Last modified... is insert at second line
self.assertIn(
'Last modified by WebSite_checkCacheModificationDateConsistency on',
self.manifest.getTextContent())
self.assertIn(manifest_content, self.manifest.getTextContent())
self.manifest.getTextContent().split('\n')[1])
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())
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