Skip to content

Commit

Permalink
coverage increase: test for graceful failing on read callback wrong r…
Browse files Browse the repository at this point in the history
…eturn type

Signed-off-by: Oleg Hoefling <[email protected]>
  • Loading branch information
hoefling committed Sep 5, 2021
1 parent 9798d6d commit fc565ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,12 @@ def test_register_non_callables(self):
cbs = self._mismatch_callbacks()
cbs[idx] = None
self.assertRaises(TypeError, xmlsec.register_callbacks, *cbs)

def test_sign_external_data_fails_on_read_callback_wrong_returns(self):
xmlsec.register_callbacks(
lambda filename: filename == b'cid:123456',
lambda filename: BytesIO(b'<html><head/><body/></html>'),
lambda bio, buf: None,
lambda bio: bio.close(),
)
self._expect_sign_failure()

0 comments on commit fc565ba

Please sign in to comment.