Skip to content

Commit

Permalink
fix cookie test
Browse files Browse the repository at this point in the history
  • Loading branch information
obfusk committed Dec 14, 2023
1 parent 476fa5d commit 33e554b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jiten/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,22 @@
>>> d.index("JLPT N3") < d.index("歯", d.index("JLPT N5")) < d.index("JLPT N2")
True
>>> sorted( (c.name, c.value) for c in client.cookie_jar )
>>> def cookies():
... import importlib.metadata
... v = tuple(map(int, importlib.metadata.version("werkzeug").split(".")))
... if v < (2, 3):
... return sorted( (c.name, c.value) for c in client.cookie_jar )
... else:
... cookies = [ client.get_cookie(k) for k in PREFS ]
... return sorted( (c.decoded_key, c.decoded_value) for c in cookies )
>>> cookies()
[]
>>> p = dict(dark = "yes", lang = "eng ger oops".split())
>>> r = client.post("/_save_prefs", data = p, follow_redirects = True)
>>> r.status
'200 OK'
>>> sorted( (c.name, c.value) for c in client.cookie_jar )
>>> cookies()
[('dark', 'yes'), ('lang', '"eng ger"'), ('large', 'no'), ('max', '50'), ('nogrid', 'no'), ('nor2h', 'no'), ('roma', 'no')]
""" # }}}1
Expand Down

0 comments on commit 33e554b

Please sign in to comment.