Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Add test for exception catching.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbangert committed Apr 9, 2015
1 parent 945a033 commit bd31fb5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions autopush/tests/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ def handle_message(result):
self._wait_for_message(d)
return d

def test_exc_catcher(self):
self.proto.log_err = Mock()
req = Mock()

def raise_error(*args, **kwargs):
raise Exception("Oops")

req.headers.get.side_effect = raise_error

with self.assertRaises(Exception):
self.proto.onConnect(req)

req.headers.get.assert_called_with("user-agent")

def test_producer_interface(self):
self._connect()
self.proto.pauseProducing()
Expand Down

0 comments on commit bd31fb5

Please sign in to comment.