def test_notify_configured_metadata_sections(self): bugsnag.add_metadata_tab('food', {'beans': 3, 'corn': 'purple'}) bugsnag.notify(ScaryException('unexpected failover')) json_body = self.server.received[0]['json_body'] event = json_body['events'][0] self.assertEqual('purple', event['metaData']['food']['corn']) self.assertEqual(3, event['metaData']['food']['beans'])
def test_notify_recursive_metadata_array(self): a = ['foo', 'bar'] a.append(a) bugsnag.add_metadata_tab('a', {'b': a}) bugsnag.notify(ScaryException('unexpected failover')) json_body = self.server.received[0]['json_body'] event = json_body['events'][0] self.assertEqual(['foo', 'bar', '[RECURSIVE]'], event['metaData']['a']['b'])
def test_notify_recursive_metadata_dict(self): a = {'foo': 'bar'} a['baz'] = a bugsnag.add_metadata_tab('a', a) bugsnag.notify(ScaryException('unexpected failover')) json_body = self.server.received[0]['json_body'] event = json_body['events'][0] self.assertEqual('bar', event['metaData']['a']['foo']) self.assertEqual('[RECURSIVE]', event['metaData']['a']['baz']['baz'])
def test_notify_override_metadata_sections(self): bugsnag.add_metadata_tab('food', {'beans': 3, 'corn': 'purple'}) bugsnag.notify(ScaryException('unexpected failover'), meta_data={'food': {'beans': 5}, 'skills': {'spear': 6}}) json_body = self.server.received[0]['json_body'] event = json_body['events'][0] self.assertEqual(6, event['metaData']['skills']['spear']) self.assertEqual('purple', event['metaData']['food']['corn']) self.assertEqual(5, event['metaData']['food']['beans'])