bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.39k stars 1.47k forks source link

test_delete_cookie fail #1380

Closed aekoroglu closed 2 years ago

aekoroglu commented 2 years ago

Master branch has that change since https://github.com/bottlepy/bottle/pull/795 but not in any tagged release.

I applied the change into Fedora as: https://src.fedoraproject.org/rpms/python-bottle/blob/rawhide/f/test_delete_cookie.patch

--- a/test/test_environ.py      2022-06-09 10:50:08.693817701 +0300
+++ b/test/test_environ.py      2022-06-09 10:50:36.223708927 +0300
@@ -624,7 +624,7 @@
         response.delete_cookie('name')
         cookies = [value for name, value in response.headerlist
                    if name.title() == 'Set-Cookie']
-        self.assertTrue('name=;' in cookies[0])
+        self.assertTrue('Max-Age=-1' in cookies[0])

     def test_set_header(self):
         response = BaseResponse()

Related issues: https://github.com/bottlepy/bottle/pull/791, https://github.com/bottlepy/bottle/pull/1125, https://github.com/bottlepy/bottle/pull/1190 and https://github.com/bottlepy/bottle/pull/1243

defnull commented 2 years ago

This fix unfortunately breaks tests for older python releases. Python SimpleCookie implementation changed behavior at some point, and 0.12 is supposed to work for Python 2.5 to 3.x. The only solution I see is to take python version into account for this test.

defnull commented 2 years ago

Cookie test is fixed now in release-0.12 branch (will be part of next release, whenever that happens).