Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed Sep 19, 2023
1 parent 8ab8f9b commit 8aa52b0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pypnusershub/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from flask import Response
from werkzeug.http import parse_cookie

from pypnusershub.utils import get_cookie_path, set_cookie
from pypnusershub.utils import get_cookie_path, set_cookie, delete_cookie

from .utils import set_logged_user_cookie


class TestUtils:
Expand Down Expand Up @@ -39,3 +41,11 @@ def test_set_cookie(self):
assert cookie_attrs[key] == value
assert cookie_attrs["Path"] == "/geonature"
assert cookie_attrs["Expires"] != ""

logout_response = delete_cookie(response, key=key, application_url=application_url)
cookie = logout_response.headers.getlist("Set-Cookie")[1]
cookie_attrs = parse_cookie(cookie)

assert cookie_attrs[key] == ""
assert cookie_attrs["Path"] == "/geonature"
assert True

0 comments on commit 8aa52b0

Please sign in to comment.