예제 #1
0
def test_async_send_queue_full(fake_server, raven_client, wait):
    server = yield from fake_server()

    with Logger('sentry.errors', level=logging.ERROR) as log:
        transport = partial(QueuedAioHttpTransport, qsize=1)

        client, transport = raven_client(server, transport)

        try:
            1 / 0
        except ZeroDivisionError:
            client.captureException()

        try:
            1 / 0
        except ZeroDivisionError:
            client.captureException()

        yield from wait(transport)

        assert server.hits[200] == 1

    msg = 'Sentry responded with an error: ' \
          'QueuedAioHttpTransport internal queue is full'
    assert log.msgs[0].startswith(msg)
예제 #2
0
 def setup(self, driver, config, request, get_database_interaction, get_vk_api_client):
     self.driver = driver
     self.config = config
     self.login_page: LoginPage = request.getfixturevalue('login_page_object')
     self.db_interaction: DbInteraction = get_database_interaction
     self.vk_api_client: VkApiClient = get_vk_api_client
     self.logger: Logger = Logger(self.config['log_writer_path'])
예제 #3
0
def test_rate_limit(fake_server, raven_client, wait):
    server = yield from fake_server()
    server.side_effect['status'] = 429

    with Logger('sentry.errors', level=logging.ERROR) as log:
        client, transport = raven_client(server, QueuedAioHttpTransport)

        try:
            1 / 0
        except ZeroDivisionError:
            client.captureException()

        yield from wait(transport)

        assert server.hits[429] == 1

    msg = 'Sentry responded with an API error: RateLimited(None)'
    assert log.msgs[0] == msg
예제 #4
0
def test_async_send_when_closed(fake_server, raven_client):
    server = yield from fake_server()

    with Logger('sentry.errors', level=logging.ERROR) as log:
        client, transport = raven_client(server, QueuedAioHttpTransport)

        close = transport.close()

        try:
            1 / 0
        except ZeroDivisionError:
            client.captureException()

        assert server.hits[200] == 0

    assert log.msgs[0].startswith(
        'Sentry responded with an error: QueuedAioHttpTransport is closed')

    yield from close
예제 #5
0
 def setup(self, config_api, get_database_interaction):
     self.config: ApiSettings = config_api
     self.api_client: ApiClient = ApiClient(config_api)
     self.db_interaction: DbInteraction = get_database_interaction
     self.logger: Logger = Logger(self.config.log_writer_path)