Permalink
Browse files

Added tests for logging handler

  • Loading branch information...
dcramer authored and gandalfar committed Jun 25, 2011
1 parent 10e8bc7 commit d6abddc358ef784bc21bb8c0d13cd9fd9f2a3abb
Showing with 8 additions and 2 deletions.
  1. +1 −1 sentry/contrib/logging/__init__.py
  2. +1 −1 tests/test_clients/test_logging.py
  3. +6 −0 tests/test_events.py
@@ -14,4 +14,4 @@
class SentryHandler(logging.Handler):
def emit(self, record):
- capture('Message', message=record.msg, params=record.args)
+ return capture('Message', message=record.msg, params=record.args)
@@ -6,7 +6,7 @@
from sentry.models import Event
class LoggingTest(BaseTest):
- def test_logging_client(self):
+ def test_simple(self):
client = get_client('sentry.client.logging.LoggingSentryClient')
_foo = {'': None}
View
@@ -204,6 +204,12 @@ def test_message_event(self):
self.assertEquals(event.type, 'sentry.events.Message')
self.assertEquals(event.time_spent, 0)
+ self.assertTrue('sentry.interfaces.Message' in event.data)
+ event_data = event.data['sentry.interfaces.Message']
+ self.assertTrue('message' in event_data)
+ self.assertEquals(event_data['message'], 'foo')
+ self.assertTrue('params' in event_data)
+ self.assertEquals(event_data['params'], [])
def test_query_event(self):
event_id = capture('Query', query='SELECT * FROM table', engine='psycopg2', time_spent=36)

0 comments on commit d6abddc

Please sign in to comment.