def _send_notice(self, exception, exc_traceback=None, context={}): payload = create_payload(exception, exc_traceback, config=self.config, context=context) if self.config.is_dev() and not self.config.force_report_data: fake_connection.send_notice(self.config, payload) else: connection.send_notice(self.config, payload)
def test_connection_success(): api_key = 'badgerbadgermushroom' payload = {'test': 'payload'} config = Configuration(api_key=api_key) def test_request(request_object): eq_(request_object.get_header('X-api-key'), api_key) eq_(request_object.get_full_url(), '{}/v1/notices/'.format(config.endpoint)) eq_(request_object.data, b(json.dumps(payload))) with mock_urlopen(test_request) as request_mock: send_notice(config, payload)