diff options
| author | David Lord <davidism@gmail.com> | 2019-02-13 11:44:18 -0800 |
|---|---|---|
| committer | David Lord <davidism@gmail.com> | 2019-03-08 08:01:31 -0800 |
| commit | ab6150fa49afc61b0c5eed6d9545d03d1958e384 (patch) | |
| tree | ad5f13c9c2775ca59cc8e82ec124c4e065a65d1b /tests/contrib/test_securecookie.py | |
| parent | 048d707d25685e6aea675c53945ceb7619e60344 (diff) | |
| download | werkzeug-code-style.tar.gz | |
apply code stylecode-style
* reorder-python-imports
* line fixers
* black
* flake8
Diffstat (limited to 'tests/contrib/test_securecookie.py')
| -rw-r--r-- | tests/contrib/test_securecookie.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/tests/contrib/test_securecookie.py b/tests/contrib/test_securecookie.py index 80e82147..7231ac88 100644 --- a/tests/contrib/test_securecookie.py +++ b/tests/contrib/test_securecookie.py @@ -9,54 +9,59 @@ :license: BSD-3-Clause """ import json + import pytest from werkzeug._compat import to_native -from werkzeug.utils import parse_cookie -from werkzeug.wrappers import Request, Response from werkzeug.contrib.securecookie import SecureCookie +from werkzeug.utils import parse_cookie +from werkzeug.wrappers import Request +from werkzeug.wrappers import Response def test_basic_support(): - c = SecureCookie(secret_key=b'foo') + c = SecureCookie(secret_key=b"foo") assert c.new assert not c.modified assert not c.should_save - c['x'] = 42 + c["x"] = 42 assert c.modified assert c.should_save s = c.serialize() - c2 = SecureCookie.unserialize(s, b'foo') + c2 = SecureCookie.unserialize(s, b"foo") assert c is not c2 assert not c2.new assert not c2.modified assert not c2.should_save assert c2 == c - c3 = SecureCookie.unserialize(s, b'wrong foo') + c3 = SecureCookie.unserialize(s, b"wrong foo") assert not c3.modified assert not c3.new assert c3 == {} - c4 = SecureCookie({'x': 42}, 'foo') + c4 = SecureCookie({"x": 42}, "foo") c4_serialized = c4.serialize() - assert SecureCookie.unserialize(c4_serialized, 'foo') == c4 + assert SecureCookie.unserialize(c4_serialized, "foo") == c4 def test_wrapper_support(): req = Request.from_values() resp = Response() - c = SecureCookie.load_cookie(req, secret_key=b'foo') + c = SecureCookie.load_cookie(req, secret_key=b"foo") assert c.new - c['foo'] = 42 - assert c.secret_key == b'foo' + c["foo"] = 42 + assert c.secret_key == b"foo" c.save_cookie(resp) - req = Request.from_values(headers={ - 'Cookie': 'session="%s"' % parse_cookie(resp.headers['set-cookie'])['session'] - }) - c2 = SecureCookie.load_cookie(req, secret_key=b'foo') + req = Request.from_values( + headers={ + "Cookie": 'session="%s"' + % parse_cookie(resp.headers["set-cookie"])["session"] + } + ) + c2 = SecureCookie.load_cookie(req, secret_key=b"foo") assert not c2.new assert c2 == c |
