1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-05 22:32:33 +00:00
trezor-firmware/tests/device_tests/test_debug_sdcard_insert.py
obrusvit f35ffa0c18 feat(core/sdbackup): insert/eject emulator SD card
- access through DebugLink
- card can be initialized with
    - serial_number (used for filename and later for shamir backup
      functionality)
    - capacity in bytes
    - manufacturer ID (used for recognition of Trezor card together with
      capacity)
- one debug protobuf message added serial_number set to None means
  ejecting the card from emulator
- TODO: initialize the card with preexisting data
2024-01-16 15:27:13 +01:00

35 lines
986 B
Python

import pytest
from trezorlib.debuglink import TrezorClientDebugLink as Client
pytestmark = [pytest.mark.skip_t1, pytest.mark.skip_tr]
@pytest.mark.sd_card(formatted=True)
def test_sd_eject(client: Client):
print(client.features)
assert client.features.sd_card_present is True
client.debug.eject_sd_card()
client.refresh_features()
print(client.features)
assert client.features.sd_card_present is False
client.debug.insert_sd_card(2)
client.debug.erase_sd_card(format=True)
client.refresh_features()
assert client.features.sd_card_present is True
client.debug.eject_sd_card()
client.refresh_features()
assert client.features.sd_card_present is False
client.debug.insert_sd_card(3)
client.debug.erase_sd_card(format=False)
client.refresh_features()
assert client.features.sd_card_present is True
client.debug.eject_sd_card()
client.refresh_features()
assert client.features.sd_card_present is False