diff options
| author | David Cramer <cramer@dropbox.com> | 2014-05-22 00:25:46 -0700 |
|---|---|---|
| committer | David Cramer <cramer@dropbox.com> | 2014-05-22 00:25:46 -0700 |
| commit | b9bd240a79fdf4c3671c3626a72cd0294cc419a7 (patch) | |
| tree | ce0a190ef5b537bdb41ee27a95d65817e4102673 /tests/base/tests.py | |
| parent | 39c65bf8b500ed62d8469f5bc7ffe08badcf194c (diff) | |
| parent | 7e2e765c50b0b5814931e8e7cdf7f7c3cf964f96 (diff) | |
| download | raven-b9bd240a79fdf4c3671c3626a72cd0294cc419a7.tar.gz | |
Merge branch 'raise_send_errors' of https://github.com/richg/raven-python into richg-raise_send_errors
Conflicts:
raven/base.py
raven/contrib/django/client.py
raven/handlers/logbook.py
raven/handlers/logging.py
tests/handlers/logging/tests.py
Diffstat (limited to 'tests/base/tests.py')
| -rw-r--r-- | tests/base/tests.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/base/tests.py b/tests/base/tests.py index 96b849e..c603523 100644 --- a/tests/base/tests.py +++ b/tests/base/tests.py @@ -216,6 +216,35 @@ class ClientTest(TestCase): }, ) + @mock.patch('raven.transport.http.HTTPTransport.send') + @mock.patch('raven.base.ClientState.should_try') + def test_raise_exception_on_send_error(self, should_try, _send_remote): + should_try.return_value = True + client = Client( + servers=['sync+http://example.com'], + public_key='public', + secret_key='secret', + project=1, + ) + + # Test for the default behaviour in which a send error is handled by the client + _send_remote.side_effect = Exception() + client.capture('Message', data={}, date=None, time_spent=10, + extra={}, stack=None, tags=None, message='Test message') + assert client.state.status == client.state.ERROR + + # Test for the case in which a send error is raised to the calling frame. + client = Client( + servers=['sync+http://example.com'], + public_key='public', + secret_key='secret', + project=1, + raise_send_errors=True, + ) + with self.assertRaises(Exception): + client.capture('Message', data={}, date=None, time_spent=10, + extra={}, stack=None, tags=None, message='Test message') + def test_encode_decode(self): data = {'foo': 'bar'} encoded = self.client.encode(data) |
