Commit dc2a5acd authored by Vincent Bechu's avatar Vincent Bechu

[officejs_test] fix tests

Remove charset format for content type
Add hash when necessary

/reviewed-on nexedi/officejs-appstore!1
parent 1c3fad1b
...@@ -129,9 +129,9 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -129,9 +129,9 @@ class TestOfficeJSScenario(SecurityTestCase):
response.getheader('Cache-Control'), response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate' 'max-age=0, public, must-revalidate'
) )
self.assertEquals( self.assertTrue(
response.getheader('Content-Type'), 'text/html;' in response.getheader('Content-Type'),
'text/html; charset=utf-8' response.getheader('Content-Type')
) )
self.assertEquals( self.assertEquals(
response.getheader('Content-Security-Policy'), response.getheader('Content-Security-Policy'),
...@@ -142,7 +142,7 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -142,7 +142,7 @@ class TestOfficeJSScenario(SecurityTestCase):
'SAMEORIGIN' 'SAMEORIGIN'
) )
self.assertEquals( self.assertEquals(
response.getheader('Vary'), response.getheader('Vary').replace(' ', ''),
'Accept-Language,Cookie,Authorization,Accept-Encoding' 'Accept-Language,Cookie,Authorization,Accept-Encoding'
) )
...@@ -157,14 +157,14 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -157,14 +157,14 @@ class TestOfficeJSScenario(SecurityTestCase):
page_content = response.read() page_content = response.read()
self.assertEquals("""CACHE MANIFEST self.assertEquals("""CACHE MANIFEST
# development""", # development + hash""",
page_content page_content
) )
self.assertEquals(response.status, 200) self.assertEquals(response.status, 200)
self.assertEquals( self.assertTrue(
response.getheader('Content-Type'), 'text/cache-manifest;' in response.getheader('Content-Type'),
'text/cache-manifest; charset=utf-8' response.getheader('Content-Type')
) )
self.assertEquals( self.assertEquals(
response.getheader('Cache-Control'), response.getheader('Cache-Control'),
...@@ -189,9 +189,9 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -189,9 +189,9 @@ class TestOfficeJSScenario(SecurityTestCase):
response.getheader('Cache-Control'), response.getheader('Cache-Control'),
'max-age=31536000, stale-while-revalidate=31536000, stale-if-error=31536000, public' 'max-age=31536000, stale-while-revalidate=31536000, stale-if-error=31536000, public'
) )
self.assertEquals( self.assertTrue(
response.getheader('Content-Type'), 'text/html;' in response.getheader('Content-Type'),
'text/html; charset=utf-8' response.getheader('Content-Type')
) )
self.assertEquals( self.assertEquals(
response.getheader('Content-Security-Policy'), response.getheader('Content-Security-Policy'),
...@@ -243,9 +243,9 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -243,9 +243,9 @@ class TestOfficeJSScenario(SecurityTestCase):
response.getheader('Cache-Control'), response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate' 'max-age=0, public, must-revalidate'
) )
self.assertEquals( self.assertTrue(
response.getheader('Content-Type'), 'text/html;' in response.getheader('Content-Type'),
'text/html; charset=utf-8' response.getheader('Content-Type')
) )
self.assertEquals( self.assertEquals(
response.getheader('Content-Security-Policy'), response.getheader('Content-Security-Policy'),
...@@ -256,7 +256,7 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -256,7 +256,7 @@ class TestOfficeJSScenario(SecurityTestCase):
'SAMEORIGIN' 'SAMEORIGIN'
) )
self.assertEquals( self.assertEquals(
response.getheader('Vary'), response.getheader('Vary').replace(' ', ''),
'Accept-Language,Cookie,Authorization,Accept-Encoding' 'Accept-Language,Cookie,Authorization,Accept-Encoding'
) )
...@@ -279,7 +279,7 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -279,7 +279,7 @@ class TestOfficeJSScenario(SecurityTestCase):
page_content = response.read() page_content = response.read()
self.assertTrue( self.assertTrue(
'document.location.replace("%s/")' % web_section.getId() in page_content, 'document.location.replace("%s/" + document.location.hash)' % web_section.getId() in page_content,
page_content page_content
) )
self.assertTrue( self.assertTrue(
...@@ -291,9 +291,9 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -291,9 +291,9 @@ class TestOfficeJSScenario(SecurityTestCase):
response.getheader('Cache-Control'), response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate' 'max-age=0, public, must-revalidate'
) )
self.assertEquals( self.assertTrue(
response.getheader('Content-Type'), 'text/html;' in response.getheader('Content-Type'),
'text/html; charset=utf-8' response.getheader('Content-Type')
) )
self.assertEquals( self.assertEquals(
response.getheader('Content-Security-Policy'), response.getheader('Content-Security-Policy'),
...@@ -304,7 +304,7 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -304,7 +304,7 @@ class TestOfficeJSScenario(SecurityTestCase):
'SAMEORIGIN' 'SAMEORIGIN'
) )
self.assertEquals( self.assertEquals(
response.getheader('Vary'), response.getheader('Vary').replace(' ', ''),
'Accept-Language,Cookie,Authorization,Accept-Encoding' 'Accept-Language,Cookie,Authorization,Accept-Encoding'
) )
...@@ -318,14 +318,14 @@ class TestOfficeJSScenario(SecurityTestCase): ...@@ -318,14 +318,14 @@ class TestOfficeJSScenario(SecurityTestCase):
page_content = response.read() page_content = response.read()
self.assertEquals("""CACHE MANIFEST self.assertEquals("""CACHE MANIFEST
# %s""" % web_section.getId(), # %s + hash""" % web_section.getId(),
page_content page_content
) )
self.assertEquals(response.status, 200) self.assertEquals(response.status, 200)
self.assertEquals( self.assertTrue(
response.getheader('Content-Type'), 'text/cache-manifest;' in response.getheader('Content-Type'),
'text/cache-manifest; charset=utf-8' response.getheader('Content-Type')
) )
self.assertEquals( self.assertEquals(
response.getheader('Cache-Control'), response.getheader('Cache-Control'),
......
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