summaryrefslogtreecommitdiff
path: root/tests/test_viewstate.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2020-02-01 12:59:51 +0200
committerYuval Adam <_@yuv.al>2020-02-01 12:59:51 +0200
commitb0668017d1d6266d0420d82a0c6467138d1e1b21 (patch)
tree53ba9a0664b86ae054424da634cb112e2dea41c0 /tests/test_viewstate.py
parent8ecb86371b2cb99e0460b15320c2ffbd77ced138 (diff)
Run black on entire codebase
Diffstat (limited to 'tests/test_viewstate.py')
-rw-r--r--tests/test_viewstate.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/test_viewstate.py b/tests/test_viewstate.py
index 9cc9285..628e1e0 100644
--- a/tests/test_viewstate.py
+++ b/tests/test_viewstate.py
@@ -6,43 +6,42 @@ from viewstate import *
class TestViewState(object):
-
def test_blank(self):
vs = ViewState()
assert not vs.is_valid()
def test_is_valid(self):
- for root, dirs, files in walk('tests/samples'):
+ for root, dirs, files in walk("tests/samples"):
for f in files:
- with open(join(root, f), 'r') as t:
+ with open(join(root, f), "r") as t:
vs = ViewState(t.read())
assert vs.is_valid() is True
def test_invalid_base64(self):
with pytest.raises(ViewStateException):
- vs = ViewState('hello')
+ vs = ViewState("hello")
def test_invalid_decode(self):
with pytest.raises(ViewStateException):
- vs = ViewState(raw=b'\x01\x02')
+ vs = ViewState(raw=b"\x01\x02")
vs.decode()
def test_no_signature(self):
- vs = ViewState(raw=b'\xff\x01e')
+ vs = ViewState(raw=b"\xff\x01e")
vs.decode()
assert vs.mac is None
assert vs.signature is None
def test_macs(self):
MAC_LENGTHS = {
- 'hmac_sha1': 20,
- 'hmac_sha256': 32,
- 'unknown': 5 # could be any other value
+ "hmac_sha1": 20,
+ "hmac_sha256": 32,
+ "unknown": 5, # could be any other value
}
for mac, n in MAC_LENGTHS.items():
- sig = b'\x55' * n # not a real signature, just testing length
- vs = ViewState(raw=b'\xff\x01d' + sig)
+ sig = b"\x55" * n # not a real signature, just testing length
+ vs = ViewState(raw=b"\xff\x01d" + sig)
vs.decode()
assert vs.mac == mac
assert vs.signature == sig