mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-01 05:23:47 +08:00
Add backward compat APIs (#14427)
### What problem does this PR solve? Add backward compat APIs: ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -259,7 +259,7 @@ def test_list_files_validation_error(monkeypatch):
|
||||
module = _load_file_api_module(monkeypatch)
|
||||
monkeypatch.setattr(module, "validate_and_parse_request_args", lambda _request, _schema: (None, "bad args"))
|
||||
|
||||
res = module.list_files("tenant1")
|
||||
res = _run(module.list_files("tenant1"))
|
||||
assert res["code"] == 400
|
||||
assert res["message"] == "bad args"
|
||||
|
||||
@@ -330,8 +330,8 @@ def test_download_falls_back_to_document_storage(monkeypatch):
|
||||
def test_parent_and_ancestors_use_new_routes(monkeypatch):
|
||||
module = _load_file_api_module(monkeypatch)
|
||||
|
||||
parent_res = module.parent_folder("tenant1", "file1")
|
||||
ancestors_res = module.ancestors("tenant1", "file1")
|
||||
parent_res = _run(module.parent_folder("tenant1", "file1"))
|
||||
ancestors_res = _run(module.ancestors("tenant1", "file1"))
|
||||
|
||||
assert parent_res["code"] == 0
|
||||
assert parent_res["data"]["parent_folder"]["id"] == "parent1"
|
||||
|
||||
@@ -79,6 +79,10 @@ def _load_apps_module(monkeypatch):
|
||||
api_utils_mod.server_error_response = _server_error_response
|
||||
monkeypatch.setitem(sys.modules, "api.utils.api_utils", api_utils_mod)
|
||||
|
||||
backward_compat_mod = ModuleType("api.apps.backward_compat")
|
||||
backward_compat_mod.register_backward_compat_routes = lambda _app: None
|
||||
monkeypatch.setitem(sys.modules, "api.apps.backward_compat", backward_compat_mod)
|
||||
|
||||
module_name = "test_apps_init_unit_module"
|
||||
module_path = repo_root / "api" / "apps" / "__init__.py"
|
||||
spec = importlib.util.spec_from_file_location(module_name, module_path)
|
||||
|
||||
Reference in New Issue
Block a user