Commit e0dec940 authored by Xiaowu Zhang's avatar Xiaowu Zhang

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

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