56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
from fastapi_modules.fastapi_leaudit.services.impl.crossReviewServiceImpl import CrossReviewServiceImpl
|
|
|
|
|
|
def test_cross_review_task_item_masks_progress_without_permission():
|
|
item = CrossReviewServiceImpl._build_task_item_vo(
|
|
row={
|
|
"task_id": 10,
|
|
"task_name": "交叉评查任务",
|
|
"task_type": "CITY",
|
|
"doc_type_id": 2,
|
|
"doc_type_code": "contract",
|
|
"status": "in_progress",
|
|
"total_documents": 4,
|
|
"completed_documents": 1,
|
|
"current_user_role": "principal",
|
|
"current_user_can_confirm": True,
|
|
"create_time": None,
|
|
"evaluation_tenants": [],
|
|
"evaluation_regions": [],
|
|
},
|
|
CanViewProgress=False,
|
|
)
|
|
|
|
assert item.progress is None
|
|
assert item.totalDocuments is None
|
|
assert item.completedDocuments is None
|
|
assert item.currentUserRole == "principal"
|
|
assert item.currentUserCanConfirm is True
|
|
|
|
|
|
def test_cross_review_task_item_keeps_progress_with_permission():
|
|
item = CrossReviewServiceImpl._build_task_item_vo(
|
|
row={
|
|
"task_id": 10,
|
|
"task_name": "交叉评查任务",
|
|
"task_type": "CITY",
|
|
"doc_type_id": 2,
|
|
"doc_type_code": "contract",
|
|
"status": "in_progress",
|
|
"total_documents": 4,
|
|
"completed_documents": 1,
|
|
"current_user_role": "participant",
|
|
"current_user_can_confirm": False,
|
|
"create_time": None,
|
|
"evaluation_tenants": [],
|
|
"evaluation_regions": [],
|
|
},
|
|
CanViewProgress=True,
|
|
)
|
|
|
|
assert item.progress == 25
|
|
assert item.totalDocuments == 4
|
|
assert item.completedDocuments == 1
|
|
assert item.currentUserRole == "participant"
|
|
assert item.currentUserCanConfirm is False
|