Пример #1
0
def test_nop_cmd():
    cmd = CmdNop()
    assert cmd.info()

    data = cmd.export()
    assert len(data) == 16
    assert len(data) == cmd.raw_size

    cmd_parsed = parse_command(data)
    assert cmd == cmd_parsed
Пример #2
0
def test_load_cmd_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Incorrect header tag"):
        CmdLoad.parse(data)
Пример #3
0
def test_cmd_header_comparision():
    cmd_header = CmdHeader(tag=1)
    cmd = CmdNop()
    assert cmd_header != cmd
Пример #4
0
def test_nop_cmd_invalid_parse():
    cmd = CmdLoad(address=100, data=b"\x00" * 100)
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Incorrect header tag"):
        CmdNop.parse(data)
Пример #5
0
def test_invalid_crc():
    cmd = CmdNop()
    with pytest.raises(SPSDKError):
        cmd.parse(bytes(20))
Пример #6
0
def test_version_check_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdVersionCheck.parse(data)
Пример #7
0
def test_prog_cmd_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdProg.parse(data)
Пример #8
0
def test_mem_enable_cmd_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdMemEnable.parse(data)
Пример #9
0
def test_erase_invalid():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdErase.parse(data)
Пример #10
0
def test_fill_cmd_incorrect_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Incorrect header tag"):
        CmdFill.parse(data)