def test_close_resource(client, cache): page_size = 10 result = cache_put_all(client, cache, { 'key_{}'.format(v): v for v in range(page_size * 2) }) assert result.status == 0 result = scan(client, cache, page_size) assert result.status == 0 assert len(result.value['data']) == page_size assert result.value['more'] is True cursor = result.value['cursor'] result = resource_close(client, cursor) assert result.status == 0 result = scan_cursor_get_page(client, cursor) assert result.status != 0
def test_close_resource(client, cache): page_size = 10 result = cache_put_all( client, cache, {'key_{}'.format(v): v for v in range(page_size * 2)}) assert result.status == 0 result = scan(client, cache, page_size) assert result.status == 0 assert len(result.value['data']) == page_size assert result.value['more'] is True cursor = result.value['cursor'] result = resource_close(client, cursor) assert result.status == 0 result = scan_cursor_get_page(client, cursor) assert result.status != 0
def close(self): """ Close cursor. """ if self.connection and self.cursor_id and self.more: resource_close(self.connection, self.cursor_id)
def check(): result = resource_close(cursor.connection, cursor.cursor_id) assert result.status != 0