def test_notify_context_merging(): def test_payload(request): payload = json.loads(request.data.decode('utf-8')) eq_(payload['request']['context'], dict(foo='bar', bar='foo')) hb = Honeybadger() with mock_urlopen(test_payload) as request_mock: hb.configure(api_key='aaa', force_report_data=True) hb.set_context(foo='bar') hb.notify(error_class='Exception', error_message='Test.', context=dict(bar='foo'))
def test_notify_context_merging(): def test_payload(request): payload = json.loads(request.data.decode('utf-8')) eq_(payload['request']['context'], dict(foo='bar', bar='foo')) hb = Honeybadger() with mock_urlopen(test_payload) as request_mock: hb.configure(api_key='aaa') hb.set_context(foo='bar') hb.notify(error_class='Exception', error_message='Test.', context=dict(bar='foo'))
def test_set_context(): honeybadger = Honeybadger() honeybadger.set_context(foo='bar') eq_(honeybadger.thread_local.context, dict(foo='bar')) honeybadger.set_context(bar='foo') eq_(honeybadger.thread_local.context, dict(foo='bar', bar='foo'))