chore(repo): initialize team collaboration repository
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
from flashops_control.safety import PreflightRequest, run_preflight
|
||||
|
||||
|
||||
def valid_request(**overrides):
|
||||
values = {
|
||||
"expected_serial": "DUT-001",
|
||||
"discovered_serial": "DUT-001",
|
||||
"allow_destructive": True,
|
||||
"device_path": "/dev/nvme1n1",
|
||||
"system_device_paths": ["/dev/nvme0n1", "/dev/nvme0n1p2"],
|
||||
"firmware_model_allowed": True,
|
||||
"host_online": True,
|
||||
"oob_online": True,
|
||||
}
|
||||
values.update(overrides)
|
||||
return PreflightRequest(**values)
|
||||
|
||||
|
||||
def test_all_safety_gates_pass_for_bound_test_disk():
|
||||
result = run_preflight(valid_request())
|
||||
assert result.passed is True
|
||||
assert len(result.checks) == 6
|
||||
|
||||
|
||||
def test_serial_mismatch_is_rejected():
|
||||
result = run_preflight(valid_request(discovered_serial="WRONG-DISK"))
|
||||
assert result.passed is False
|
||||
assert next(check for check in result.checks if check.key == "serial").passed is False
|
||||
|
||||
|
||||
def test_system_partition_is_rejected():
|
||||
result = run_preflight(valid_request(device_path="/dev/nvme0n1p2"))
|
||||
assert result.passed is False
|
||||
assert next(check for check in result.checks if check.key == "system_disk").passed is False
|
||||
|
||||
|
||||
def test_destructive_opt_in_is_required():
|
||||
result = run_preflight(valid_request(allow_destructive=False))
|
||||
assert result.passed is False
|
||||
Reference in New Issue
Block a user