Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Boenninghausen committed Oct 23, 2024
1 parent a7f1df7 commit 83ed0da
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def test_handler(self, handler: CustomHandler):
envelope.peer = "127.0.0.1"
envelope.mail_to = mail.sender
envelope.rcpt_to = [mail.receiver]
envelope.data = mail.to_mime_text().as_string().encode('utf-8')
envelope.data = mail.to_mime_text().as_string().encode("utf-8")
await handler.handle_DATA(None, None, envelope)
assert handler.swap_sender_receiver.called
assert handler.send_mail.called
Expand All @@ -102,8 +102,9 @@ def test_run(self, responder: Responder):
responder.controller.start = Mock()
responder.controller.stop = Mock()

with patch("builtins.input", return_value=""):
responder.run()
with patch("time.sleep", side_effect=[None, KeyboardInterrupt]):
with pytest.raises(KeyboardInterrupt):
responder.run()
assert responder.init_controller.called
assert responder.controller.start.called
assert responder.controller.stop.called
Expand Down

0 comments on commit 83ed0da

Please sign in to comment.