Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert changes to tests to work with the Zope security fix. [master] #109

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions news/1089.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Revert changes to tests to work with the Zope security fix.
We must have an empty byte, not text, otherwise it is an indication that we get a possibly wrong Content-Type in a 304 status.
See `Zope issue 1089 <https://github.com/zopefoundation/Zope/issues/1089>`_.
[maurits]
18 changes: 13 additions & 5 deletions plone/app/caching/tests/test_profile_with_caching_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ def test_composite_viewsxx(self):
browser.open(self.portal["f1"]["d1"].absolute_url())
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
# We MUST have an empty byte, not text, otherwise it is an indication that we
# get a possibly wrong Content-Type in a 304 status.
# See https://github.com/zopefoundation/Zope/issues/1089.
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request the anonymous folder
now = stable_now()
Expand Down Expand Up @@ -274,7 +278,8 @@ def test_composite_viewsxx(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Edit the page to update the etag
testText2 = "Testing... body two"
Expand Down Expand Up @@ -369,7 +374,8 @@ def test_content_feeds(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request the authenticated rss feed
now = stable_now()
Expand Down Expand Up @@ -504,7 +510,8 @@ def test_content_files(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request an image scale
now = stable_now()
Expand Down Expand Up @@ -560,7 +567,8 @@ def test_resources(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request a large datafile (over 64K) to test files that use
# the "response.write()" function to initiate a streamed response.
Expand Down
18 changes: 13 additions & 5 deletions plone/app/caching/tests/test_profile_without_caching_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ def test_composite_views(self):
browser.open(self.portal["f1"]["d1"].absolute_url())
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
# We MUST have an empty byte, not text, otherwise it is an indication that we
# get a possibly wrong Content-Type in a 304 status.
# See https://github.com/zopefoundation/Zope/issues/1089.
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request the anonymous folder
now = stable_now()
Expand Down Expand Up @@ -245,7 +249,8 @@ def test_composite_views(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Edit the page to update the etag
testText2 = "Testing... body two"
Expand Down Expand Up @@ -334,7 +339,8 @@ def test_content_feeds(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request the authenticated rss feed
now = stable_now()
Expand Down Expand Up @@ -421,7 +427,8 @@ def test_content_files(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request an image scale
now = stable_now()
Expand Down Expand Up @@ -471,7 +478,8 @@ def test_resources(self):
)
# This should be a 304 response
self.assertEqual("304 Not Modified", browser.headers["Status"])
self.assertEqual("", browser.contents)
self.assertEqual(b"", browser.contents)
self.assertFalse(browser.headers["Content-Type"])

# Request a large datafile (over 64K) to test files that use
# the "response.write()" function to initiate a streamed response.
Expand Down