mirror of
https://github.com/esphome/esphome.git
synced 2026-09-29 16:00:23 +00:00
[nrf52] Test that the mcumgr image is offered beside a UF2 (#19804)
This commit is contained in:
@@ -50,3 +50,37 @@ def test_recorded_firmware_path_yields_downloads(platform: str, tmp_path: Path)
|
||||
assert all(
|
||||
{"title", "description", "file", "download"} <= entry.keys() for entry in types
|
||||
)
|
||||
|
||||
|
||||
def _nrf52_files(tmp_path: Path, *built: str) -> list[str]:
|
||||
"""The files nrf52 offers for a build directory holding *built*."""
|
||||
(tmp_path / "zephyr").mkdir()
|
||||
for name in built:
|
||||
(tmp_path / name).touch()
|
||||
storage = _wizard_storage()
|
||||
storage.firmware_bin_path = tmp_path / "firmware.bin"
|
||||
return [entry["file"] for entry in _download_types("nrf52", storage)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("built", "expected"),
|
||||
[
|
||||
# Adafruit bootloader with the mcumgr OTA: MCUboot is chained behind it.
|
||||
(
|
||||
["zephyr/zephyr.uf2", "zephyr/app_update.bin"],
|
||||
["zephyr/zephyr.uf2", "firmware.zip", "zephyr/app_update.bin"],
|
||||
),
|
||||
(["zephyr/zephyr.uf2"], ["zephyr/zephyr.uf2", "firmware.zip"]),
|
||||
(
|
||||
["zephyr/merged.hex", "zephyr/app_update.bin"],
|
||||
["zephyr/merged.hex", "zephyr/app_update.bin"],
|
||||
),
|
||||
(["zephyr/merged.hex"], ["zephyr/merged.hex"]),
|
||||
([], ["zephyr/zephyr.hex"]),
|
||||
],
|
||||
)
|
||||
def test_nrf52_offers_the_mcumgr_image_whenever_it_was_built(
|
||||
tmp_path: Path, built: list[str], expected: list[str]
|
||||
) -> None:
|
||||
"""The mcumgr update image is offered beside a UF2 as well as beside a HEX."""
|
||||
assert _nrf52_files(tmp_path, *built) == expected
|
||||
|
||||
Reference in New Issue
Block a user