Test: Added test cases for Parse Documents HTTP API (#6235)

### What problem does this PR solve?

cover [parse
documents](https://ragflow.io/docs/dev/http_api_reference#parse-documents)
endpoints

### Type of change

- [x] add test cases
This commit is contained in:
liu an
2025-03-18 17:39:24 +08:00
committed by GitHub
parent f982771131
commit 9515ed401f
5 changed files with 345 additions and 3 deletions

View File

@ -15,7 +15,9 @@
#
import base64
import functools
import hashlib
import time
from pathlib import Path
@ -35,3 +37,22 @@ def compare_by_hash(file1, file2, algorithm="sha256"):
return hash_func.hexdigest()
return _calc_hash(file1) == _calc_hash(file2)
def wait_for(timeout=10, interval=1, error_msg="Timeout"):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
start_time = time.time()
while True:
result = func(*args, **kwargs)
if result is True:
return result
elapsed = time.time() - start_time
if elapsed > timeout:
assert False, error_msg
time.sleep(interval)
return wrapper
return decorator