Skip to content

Commit

Permalink
Merge pull request #777 from tlsfuzzer/descriptive-ExpectAlert
Browse files Browse the repository at this point in the history
ExpectAlert - add __repr__
  • Loading branch information
tomato42 committed Sep 29, 2021
2 parents 09d51ea + 34b0bc2 commit dbd56c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_tlsfuzzer_expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3104,6 +3104,12 @@ def test_process_with_multiple_values_not_matching_anything(self):
"not match received "
"\"255\"")

def test___str__(self):
exp = ExpectAlert(AlertLevel.warning,
AlertDescription.illegal_parameter)

self.assertEqual(str(exp), "ExpectAlert(level=1, description=47)")


class TestExpectSSL2Alert(unittest.TestCase):
def test___init__(self):
Expand Down
4 changes: 4 additions & 0 deletions tlsfuzzer/expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,10 @@ def process(self, state, msg):
if problem_desc:
raise AssertionError(problem_desc)

def __repr__(self):
"""Return human readable representation of object."""
return self._repr(["level", "description"])


class ExpectSSL2Alert(ExpectHandshake):
"""Processing of SSLv2 Handshake protocol alert messages"""
Expand Down

0 comments on commit dbd56c1

Please sign in to comment.