48 lines
2.1 KiB
Python
48 lines
2.1 KiB
Python
"""Imported plans must offer an actionable route to execution."""
|
|
import pytest
|
|
from dx_productivity.trial_task_center.target_plan import ComponentTarget, TargetPlanRow
|
|
|
|
|
|
def test_imported_plan_can_be_saved_from_execution_button(ui):
|
|
window = ui.window
|
|
task = ui.tasks[0]
|
|
project = ui.store.list_projects(task.task_id)[0].path
|
|
rows = (TargetPlanRow(ComponentTarget(project, 'MAIN', '1', 'imported-r1', 'R1', 'OLD', '100nF'), True, 'NEW'),)
|
|
ui.store.record_target_inventory(task.task_id, tuple(row.target for row in rows))
|
|
window.plan_panel._preview_import(rows)
|
|
ui.settle()
|
|
assert window.run_panel.quick_run_button.isEnabled()
|
|
assert '保存' in window.run_panel.quick_run_button.text()
|
|
confirmations = []
|
|
window._quick_run_confirmer = lambda *args: confirmations.append(args) or False
|
|
window.run_panel.quick_run_button.click()
|
|
ui.settle()
|
|
assert ui.service.target_plan(task.task_id) == rows
|
|
assert not window.plan_panel.table.dirty
|
|
assert window.run_panel.quick_run_button.isEnabled()
|
|
assert not ui.calls
|
|
assert confirmations == [('current', 1, 1)]
|
|
|
|
|
|
@pytest.mark.parametrize('batch', [False, True])
|
|
def test_manual_confirmation_obeys_fresh_preflight_blockers(ui, batch):
|
|
window = ui.window
|
|
ui.settle()
|
|
project = ui.store.list_projects(ui.tasks[0].task_id)[0].path
|
|
project.unlink()
|
|
confirmations = []
|
|
window._quick_run_confirmer = lambda *args: confirmations.append(args) or False
|
|
(window.task_list.queue_button if batch else window.run_panel.quick_run_button).click()
|
|
assert confirmations == []
|
|
assert not ui.calls and not window._workers
|
|
|
|
|
|
def test_missing_independent_report_is_visible_after_saved_execution(ui):
|
|
window = ui.window
|
|
ui.settle()
|
|
window._set_operator_message('任务已结束:已保存 1。', 'success')
|
|
window._show_receipt_verification({'acceptance': {'status': 'unavailable',
|
|
'tasks': {ui.tasks[0].task_id: 'unavailable'}}})
|
|
assert '独立网表' in window.run_panel.operator_band.text()
|
|
assert '未完成' in window.run_panel.operator_band.text()
|