Skip to content

Commit

Permalink
chore: increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
andruten committed Oct 18, 2024
1 parent 1d80f40 commit 30aac6c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,38 @@ def test_valid_attr_in_cookie_from_string(self):
self.assertIn('_cookie_session',
utils.cookie_from_string(cookie)['key'])

def test_none_cookie(self):
cookie = "_cookie_session=1266bb13c139cfba3ed1c9c68110bae9;"\
"expires=Thu, 29 Jan 2015 13:51:41 -0000; httponly;"\
"secure;Path=/gitlab;max-age=null;samesite=lax"

self.assertIn('path', utils.cookie_from_string(cookie))
self.assertIn('/', utils.cookie_from_string(cookie)['path'])

self.assertIn('expires', utils.cookie_from_string(cookie))
self.assertIn('Thu, 29 Jan 2015 13:51:41 -0000',
utils.cookie_from_string(cookie)['expires'])

self.assertIn('httponly', utils.cookie_from_string(cookie))
self.assertTrue(utils.cookie_from_string(cookie)['httponly'])

self.assertIn('secure', utils.cookie_from_string(cookie))
self.assertTrue(utils.cookie_from_string(cookie)['secure'])

self.assertIn('samesite', utils.cookie_from_string(cookie))
self.assertIn('lax', utils.cookie_from_string(cookie)['samesite'])

self.assertIn('max_age', utils.cookie_from_string(cookie))
self.assertEqual(None, utils.cookie_from_string(cookie)['max_age'])

self.assertIn('value', utils.cookie_from_string(cookie))
self.assertIn('1266bb13c139cfba3ed1c9c68110bae9',
utils.cookie_from_string(cookie)['value'])

self.assertIn('key', utils.cookie_from_string(cookie))
self.assertIn('_cookie_session',
utils.cookie_from_string(cookie)['key'])

def test_None_value_cookie_from_string(self):
cookie = "_cookie_session="
self.assertIn('_cookie_session',
Expand Down

0 comments on commit 30aac6c

Please sign in to comment.