更新bug
This commit is contained in:
@@ -169,7 +169,7 @@ def test_video_condition_never_uses_diagnosis_status_or_missed_status() -> None:
|
||||
assert payload["patient_id"] == 301
|
||||
|
||||
|
||||
def test_nested_appointments_confirmation_and_prescription_labels() -> None:
|
||||
def test_nested_appointments_confirmation_and_prescription_labels() -> None:
|
||||
row = _row(
|
||||
appointment_id=None,
|
||||
appointment_status=None,
|
||||
@@ -195,6 +195,62 @@ def test_nested_appointments_confirmation_and_prescription_labels() -> None:
|
||||
)
|
||||
== "编辑处方"
|
||||
)
|
||||
assert (
|
||||
prescription_action_label(
|
||||
{
|
||||
"has_prescription": 1,
|
||||
"current_has_prescription": 0,
|
||||
"prescription_audit_status": 1,
|
||||
"prescription_void_status": 0,
|
||||
}
|
||||
)
|
||||
== "开方"
|
||||
)
|
||||
|
||||
|
||||
def test_view_prescription_intent_is_readonly_and_fails_closed_on_state_change(
|
||||
application: QApplication,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
row = _row(
|
||||
has_prescription=1,
|
||||
current_has_prescription=1,
|
||||
current_prescription_id=701,
|
||||
prescription_audit_status=1,
|
||||
prescription_void_status=0,
|
||||
)
|
||||
page = ConsultationsPage(SimpleNamespace(), permissions=PermissionSet(["*"]))
|
||||
page.table_host.set_rows([row])
|
||||
page.table.selectRow(0)
|
||||
|
||||
requested: list[tuple[Any, str]] = []
|
||||
monkeypatch.setattr(
|
||||
page,
|
||||
"_begin_prescription_load",
|
||||
lambda record, *, mode: requested.append((record, mode)),
|
||||
)
|
||||
page._open_prescription()
|
||||
assert requested == [(row, "view")]
|
||||
|
||||
monkeypatch.setattr(
|
||||
page,
|
||||
"_open_existing_prescription_editor",
|
||||
lambda _existing: pytest.fail("view intent must never open the editor"),
|
||||
)
|
||||
page._prescription_loaded(
|
||||
{
|
||||
"id": 701,
|
||||
"appointment_id": 101,
|
||||
"audit_status": 0,
|
||||
"void_status": 0,
|
||||
},
|
||||
row,
|
||||
"view",
|
||||
page._prescription_generation,
|
||||
)
|
||||
assert "状态已变化" in page.banner.label.text()
|
||||
page.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_default_query_matches_admin_today_and_page_size_contract(
|
||||
@@ -611,7 +667,7 @@ def test_switching_rows_invalidates_prescription_worker_and_clears_busy(
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_native_call_does_not_reuse_video_qr_permission(
|
||||
def test_native_call_does_not_reuse_video_qr_permission(
|
||||
application: QApplication,
|
||||
) -> None:
|
||||
class VideoRepository:
|
||||
@@ -627,10 +683,17 @@ def test_native_call_does_not_reuse_video_qr_permission(
|
||||
def end_call(self, diagnosis_id: int) -> None:
|
||||
pass
|
||||
|
||||
page = ConsultationsPage(VideoRepository(), permissions=PermissionSet([]))
|
||||
emitted: list[dict[str, Any]] = []
|
||||
page.video_requested.connect(emitted.append)
|
||||
page.table.set_rows([_row()])
|
||||
live_row = _row(
|
||||
video_call_hint={
|
||||
"state": "live",
|
||||
"label": "视频通话进行中",
|
||||
"start_time": 1787102100,
|
||||
}
|
||||
)
|
||||
page = ConsultationsPage(VideoRepository(), permissions=PermissionSet([]))
|
||||
emitted: list[dict[str, Any]] = []
|
||||
page.video_requested.connect(emitted.append)
|
||||
page.table.set_rows([live_row])
|
||||
page.table.selectRow(0)
|
||||
application.processEvents()
|
||||
|
||||
@@ -638,12 +701,55 @@ def test_native_call_does_not_reuse_video_qr_permission(
|
||||
assert page.video_button.isEnabled()
|
||||
video_cell = page.table_host.fixed.indexWidget(page.table_host.model.index(0, 10))
|
||||
video_action = next(button for button in video_cell.findChildren(QToolButton))
|
||||
assert video_action.text() == "进入视频问诊"
|
||||
assert "摄像头和麦克风" in video_action.toolTip()
|
||||
page._request_video()
|
||||
assert emitted == [_video_payload(_row())]
|
||||
page.close()
|
||||
application.processEvents()
|
||||
assert video_action.text() == "进入视频问诊"
|
||||
assert emitted == []
|
||||
assert "摄像头和麦克风" in video_action.toolTip()
|
||||
page._request_video()
|
||||
assert emitted == [_video_payload(live_row)]
|
||||
assert emitted[0]["mode"] == "im"
|
||||
page.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("hint", "status_text"),
|
||||
[
|
||||
({"state": "none", "label": ""}, "暂无通话"),
|
||||
({"state": "pending_room", "label": "通话发起中,待同步房间"}, "等待接通"),
|
||||
],
|
||||
)
|
||||
def test_video_join_action_is_hidden_until_doctor_session_is_live(
|
||||
application: QApplication,
|
||||
hint: dict[str, Any],
|
||||
status_text: str,
|
||||
) -> None:
|
||||
class VideoRepository:
|
||||
def get_call_ticket(self, patient_id: int, diagnosis_id: int) -> None:
|
||||
pass
|
||||
|
||||
def start_call(self, diagnosis_id: int, patient_id: int, *, call_type: int = 2) -> None:
|
||||
pass
|
||||
|
||||
def bind_call_room(self, diagnosis_id: int, room_id: str) -> None:
|
||||
pass
|
||||
|
||||
def end_call(self, diagnosis_id: int) -> None:
|
||||
pass
|
||||
|
||||
page = ConsultationsPage(VideoRepository(), permissions=PermissionSet([]))
|
||||
emitted: list[dict[str, Any]] = []
|
||||
page.video_requested.connect(emitted.append)
|
||||
page.table.set_rows([_row(video_call_hint=hint)])
|
||||
page.table.selectRow(0)
|
||||
application.processEvents()
|
||||
|
||||
video_cell = page.table_host.fixed.indexWidget(page.table_host.model.index(0, 10))
|
||||
assert video_cell.findChildren(QToolButton) == []
|
||||
assert status_text in " ".join(label.text() for label in video_cell.findChildren(QLabel))
|
||||
page._request_video()
|
||||
assert emitted == []
|
||||
page.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in New Issue
Block a user