def test_encoding(self): configure_sdk() Hub.current.bind_client(Hub.main.client) class NotJSONSerializable(): pass with self.tasks(): raven.captureMessage('check the req', extra={'request': NotJSONSerializable()}) event = Event.objects.get() assert event.project_id == settings.SENTRY_PROJECT assert event.data['logentry']['formatted'] == 'check the req' assert 'NotJSONSerializable' in event.data['extra']['request']
def test_encoding(self): configure_sdk() Hub.current.bind_client(Hub.main.client) class NotJSONSerializable: pass with self.tasks(): raven.captureMessage("check the req", extra={"request": NotJSONSerializable()}) event = Event.objects.get() assert event.project_id == settings.SENTRY_PROJECT assert event.data["logentry"]["formatted"] == "check the req" assert "NotJSONSerializable" in event.data["extra"]["request"]
def test_encoding(self): configure_sdk() Hub.current.bind_client(Hub.main.client) class NotJSONSerializable(): pass with self.tasks(): raven.captureMessage('check the req', extra={ 'request': NotJSONSerializable() }) event = Event.objects.get() assert event.project_id == settings.SENTRY_PROJECT assert event.data['sentry.interfaces.Message']['message'] == 'check the req' assert 'NotJSONSerializable' in event.data['extra']['request']
def test_simple(self): configure_sdk() Hub.current.bind_client(Hub.main.client) with self.tasks(): event_id = raven.captureMessage("internal client test") event = Event.objects.get() assert event.project_id == settings.SENTRY_PROJECT assert event.event_id == event_id assert event.data["logentry"]["formatted"] == "internal client test"
def test_simple(self): configure_sdk() Hub.current.bind_client(Hub.main.client) with self.tasks(): event_id = raven.captureMessage('internal client test') event = Event.objects.get() assert event.project_id == settings.SENTRY_PROJECT assert event.event_id == event_id assert event.data['sentry.interfaces.Message']['message'] == \ 'internal client test'
def test_simple(self): configure_sdk() Hub.current.bind_client(Hub.main.client) with self.tasks(): event_id = raven.captureMessage("internal client test") event = nodestore.get(Event.generate_node_id(settings.SENTRY_PROJECT, event_id)) assert event["project"] == settings.SENTRY_PROJECT assert event["event_id"] == event_id assert event["logentry"]["formatted"] == "internal client test"
def test_encoding(self): configure_sdk() Hub.current.bind_client(Hub.main.client) class NotJSONSerializable: pass with self.tasks(): event_id = raven.captureMessage( "check the req", extra={"request": NotJSONSerializable()} ) event = nodestore.get(Event.generate_node_id(settings.SENTRY_PROJECT, event_id)) assert event["project"] == settings.SENTRY_PROJECT assert event["logentry"]["formatted"] == "check the req" assert "NotJSONSerializable" in event["extra"]["request"]
def test_recursion_breaker(self): configure_sdk() Hub.current.bind_client(Hub.main.client) # If this test terminates at all then we avoided recursion. with self.tasks(): with mock.patch( "sentry.event_manager.EventManager.save", side_effect=ValueError("oh no!") ) as save: event_id = raven.captureMessage("internal client test") event = nodestore.get(Event.generate_node_id(settings.SENTRY_PROJECT, event_id)) assert event is None assert_mock_called_once_with_partial( save, settings.SENTRY_PROJECT, cache_key=u"e:{}:1".format(event_id) )
def inner(*args, **kwargs): event_id = raven.captureMessage(*args, **kwargs) Hub.current.client.flush() return wait_for_ingest_consumer(lambda: eventstore.get_event_by_id( settings.SENTRY_PROJECT, event_id))