Skip to content
Myr

cookies: Fix bugs found during CI

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michael Becker · committed by Michael Becker · parent ef5875c · Browse files · 2 files+4 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−3 removed

  • other:+4 added−3 removed

2 files+4 added−3 removed

modified:requests/cookies.py+2 added-1 removed
382 unmodified lines
383 if morsel['max-age']:384 expires = time.time() + morsel['max-age']385 elif morsel['expires']:386 time_template = '%a, %d-%b-%Y %H:%M:%S GMT'387 expires = time.mktime(time.strptime(morsel['expires'], time_template))387 expires = time.mktime(388 time.strptime(morsel['expires'], time_template)) - time.timezone389 return create_cookie(390 comment=morsel['comment'],391 comment_url=bool(morsel['comment']),392 discard=False,
53 unmodified lines
modified:test_requests.py+2 added-2 removed
1014 unmodified lines
10151016 morsel = Morsel()1017 morsel['expires'] = 'Thu, 01-Jan-1970 00:00:01 GMT'1018 cookie = morsel_to_cookie(morsel)1019 self.assertEquals(cookie.expires, 18001)1019 self.assertEquals(cookie.expires, 1)10201021 def test_expires_invalid_int(self):1022 """Test case where an invalid type is passed for expires."""1023
26 unmodified lines
10501051 morsel = Morsel()1052 morsel['max-age'] = 601053 cookie = morsel_to_cookie(morsel)1054 self.assertIsInstance(cookie.expires, int)1054 self.assertTrue(isinstance(cookie.expires, int))10551056 def test_max_age_invalid_str(self):1057 """Test case where a invalid max age is passed."""1058
7 unmodified lines