forked from LedgerHQ/app-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to check status word in Boilerplate client
- Loading branch information
Showing
7 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from typing import List, Tuple, Dict, Any | ||
|
||
import pytest | ||
|
||
from boilerplate_client.exception import DeviceException | ||
from boilerplate_client.utils import parse_sw | ||
|
||
|
||
@pytest.mark.checksw | ||
def test_status_word(sw_h_path): | ||
expected_status_words: List[Tuple[str, int]] = parse_sw(sw_h_path) | ||
status_words: Dict[int, Any] = DeviceException.exc | ||
|
||
assert (len(expected_status_words) == len(status_words), | ||
f"{expected_status_words} doesn't match {status_words}") | ||
|
||
# just keep status words | ||
expected_status_words = [sw for (identifier, sw) in expected_status_words] | ||
|
||
for sw in status_words.keys(): | ||
assert sw in expected_status_words, f"{status_words[sw]}({hex(sw)}) not found in sw.h!" |