Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exclude_lines = [
'pragma: no cover',
'raise NotImplementedError',
'if __name__ == .__main__.:',
'\.\.\.',
]
ignore_errors = true
omit = ['docs/*', 'tests/*']
Expand Down
16 changes: 11 additions & 5 deletions tests/signing/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def test_sign_unsign_object(self):
["a", "list"],
"a string \u2019",
{"a": "dictionary"},
"a" * 100,
]
for obj in tests:
with self.subTest(obj=obj):
Expand Down Expand Up @@ -310,6 +311,10 @@ def test_works_with_non_ascii_keys(self):
s.sign("foo"),
)

def test_unsupported_algorithm(self):
with self.assertRaises(InvalidAlgorithm):
signing.BytesSigner("predictable-key", algorithm="whatever")


class TestFernetSigner(SimpleTestCase):
def test_fernet_signer(self):
Expand Down Expand Up @@ -344,9 +349,10 @@ def test_bad_payload(self):
# Break the signature
signer.unsign(value[:-1] + b" ")

def test_unsupported(self):
value = b"hello"
signer = signing.FernetSigner("predictable-key")

with self.assertRaises(signing.BadSignature):
signer.unsign(value)
# Break everything
signer.unsign(b"hello")

def test_unsupported_algorithm(self):
with self.assertRaises(InvalidAlgorithm):
signing.FernetSigner("predictable-key", algorithm="whatever")