mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-18 05:37:24 +08:00
Feature: Allow page_size max value 100 (#15292)
Feature: Allow page_size max value 100
This commit is contained in:
@@ -17,7 +17,14 @@
|
||||
"""Unit tests for api.apps.sdk.doc_validation module."""
|
||||
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from api.utils.pagination_utils import REST_API_MAX_PAGE_SIZE, validate_rest_api_page_size
|
||||
from api.utils.validation_utils import (
|
||||
ListDatasetReq,
|
||||
ListFileReq,
|
||||
ParserConfig,
|
||||
UpdateDocumentReq,
|
||||
validate_chunk_method,
|
||||
@@ -29,6 +36,16 @@ from api.db import FileType
|
||||
from common.constants import RetCode
|
||||
|
||||
|
||||
def test_rest_api_page_size_rejects_values_above_100():
|
||||
assert validate_rest_api_page_size(REST_API_MAX_PAGE_SIZE) == REST_API_MAX_PAGE_SIZE
|
||||
with pytest.raises(ValueError, match="page_size must be less than or equal to 100"):
|
||||
validate_rest_api_page_size(REST_API_MAX_PAGE_SIZE + 1)
|
||||
with pytest.raises(ValidationError, match="page_size must be less than or equal to 100"):
|
||||
ListDatasetReq(page_size=REST_API_MAX_PAGE_SIZE + 1)
|
||||
with pytest.raises(ValidationError, match="page_size must be less than or equal to 100"):
|
||||
ListFileReq(page_size=REST_API_MAX_PAGE_SIZE + 1)
|
||||
|
||||
|
||||
def test_validate_immutable_fields_no_changes():
|
||||
"""Test when no immutable fields are present in request."""
|
||||
update_doc_req = UpdateDocumentReq()
|
||||
@@ -311,4 +328,4 @@ def test_parser_config_normalizes_legacy_vectorize_table_column_role():
|
||||
"title": "indexing",
|
||||
"country": "metadata",
|
||||
"x": "both",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user