def setUp(self): super(DeliveryTest, self).setUp() self.config = Configuration() self.config.configure(api_key='abc', endpoint=self.server.address, use_ssl=False, asynchronous=False)
def test_create_notification_warns(): config = Configuration() req_config = RequestConfiguration.get_instance() with pytest.warns(DeprecationWarning) as record: _ = Notification(Exception('shucks'), config, req_config) assert len(record) == 1 message = str(record[0].message) assert message == ('The Notification class has been deprecated in ' + 'favor of bugsnag.event.Event and will be ' + 'removed in a future release.')
def test_failed_delivery(self): c = Configuration() self.called = False class FooDelivery: def deliver(foo, config, payload): self.called = True raise ScaryException('something gone wrong') c.configure(delivery=FooDelivery(), api_key='abc') client = Client(c) client.notify(Exception('Oh no')) self.assertTrue(self.called) del self.called
def test_delivery(self): c = Configuration() self.called = False class FooDelivery: def deliver(foo, config, payload): self.called = True c.configure(delivery=FooDelivery(), api_key='abc') client = Client(c) client.notify(Exception('Oh no')) self.assertTrue(self.called) self.assertSentReportCount(0) del self.called
def setUp(self): super(RequestsDeliveryTest, self).setUp() self.config = Configuration() self.config.configure(api_key='abc', asynchronous=False)
def test_invalid_delivery(self): c = Configuration() c.configure(delivery=44, api_key='abc') client = Client(c) client.notify(Exception('Oh no'))
def test_init_configuration(self): configuration = Configuration() client = Client(configuration=configuration, install_sys_hook=False) self.assertEqual(client.configuration, configuration)