Skip to content

Commit

Permalink
Add test for unsupported cookie hash
Browse files Browse the repository at this point in the history
  • Loading branch information
stefvanhouten committed Nov 23, 2022
1 parent 19cc59d commit 34ef96b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/test_model/test_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def testMultipleCommits(self):


class SecureCookieTest(unittest.TestCase):
"""This class is responsible for testing default CRUD behaviour on cookies."""

def setUp(self) -> None:
self.connection = CookieConnection()
self.secure_cookie = SecureCookie(self.connection)
Expand Down Expand Up @@ -178,6 +180,12 @@ def testDeprecatedHasher(self):
secure_cookie.cookies["secureCookie"],
)

def testUnsupportedHash(self):
"""Validate that a cookie is invalidated when an unsupported hash is used."""
unsupported_cookie = "unsupported+hash+data"
self.secure_cookie.cookies['secureCookie'] = unsupported_cookie
self.assertEqual(self.secure_cookie.rawcookie, None)


if __name__ == "__main__":
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))

0 comments on commit 34ef96b

Please sign in to comment.