Skip to content

Commit

Permalink
Tests: fix parsing error tests on Nanox
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Nov 9, 2023
1 parent d51b8dd commit e997b9d
Show file tree
Hide file tree
Showing 35 changed files with 13 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tests/integration/nano/test_parsing_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,47 @@ def make_path(name: str) -> Path:
app.parsing_error_signing(DEFAULT_ACCOUNT,
"0100000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e01000000000000000000000000000000000000000000ff02000000020316",
with_hash=True,
text="INVALID_TAG",
path=make_path("unknown_magic_bytes"))

app.assert_screen(Screen.Home)

app.parsing_error_signing(DEFAULT_ACCOUNT,
"03000000000000000000000000000000000000000000000000000000000000000001016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e01000000000000000000000000000000000000000000ff02000000020316",
with_hash=True,
text="INVALID_TAG",
path=make_path("unknown_operation"))

app.assert_screen(Screen.Home)

app.parsing_error_signing(DEFAULT_ACCOUNT,
"0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e010000000000000000000000000000000000000000ff02000000020316",
with_hash=True,
text="INVALID_TAG",
path=make_path("one_byte_removed_inside"))

app.assert_screen(Screen.Home)

app.parsing_error_signing(DEFAULT_ACCOUNT,
"0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e01000000000000000000000000000000000000000000ff0200000002031645",
with_hash=True,
text="INVALID_TAG",
path=make_path("one_byte_added_at_the_end"))

app.assert_screen(Screen.Home)

app.parsing_error_signing(DEFAULT_ACCOUNT,
"0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e0100000000000000000000000000000000000000000000ff02000000020316",
with_hash=True,
text="INVALID_TAG",
path=make_path("one_byte_added_inside"))

app.assert_screen(Screen.Home)

app.parsing_error_signing(DEFAULT_ACCOUNT,
"0300000000000000000000000000000000000000000000000000000000000000006c016e8874874d31c3fbd636e924d5a036a43ec8faa7d0860308362d80d30e0100000000000000000000000000000000000000000000ff02000000020316",
with_hash=True,
text="INVALID_TAG",
path=make_path("one_byte_added_inside"))

app.assert_screen(Screen.Home)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/nano/test_too_deep.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
app.parsing_error_signing(DEFAULT_ACCOUNT,
"0502000000f702000000f202000000ed02000000e802000000e302000000de02000000d902000000d402000000cf02000000ca02000000c502000000c002000000bb02000000b602000000b102000000ac02000000a702000000a2020000009d02000000980200000093020000008e02000000890200000084020000007f020000007a02000000750200000070020000006b02000000660200000061020000005c02000000570200000052020000004d02000000480200000043020000003e02000000390200000034020000002f020000002a02000000250200000020020000001b020000001602000000",
with_hash=True,
text="TOO_DEEP",
path=test_name)

app.quit()
1 change: 1 addition & 0 deletions tests/integration/nano/test_too_large.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
app.parsing_error_signing(DEFAULT_ACCOUNT,
"050092abf8e3d9e5f8cfd9ae8a9fe5f28ea1d5b5abf1af82dae8a4b68df3d1889eb6f988f5e8d31a",
with_hash=True,
text="TOO_LARGE",
path=test_name)

app.quit()
6 changes: 5 additions & 1 deletion tests/integration/nano/utils/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,15 @@ def parsing_error_signing(self,
account: Account,
message: Union[str, bytes],
with_hash: bool,
text: str,
path: Union[str, Path]) -> None:
if self.backend.firmware.device != "nanox":
text = "Parsing error"

self._failing_signing(account,
message,
with_hash,
"Parsing error",
text,
StatusCode.PARSE_ERROR,
path)

Expand Down

0 comments on commit e997b9d

Please sign in to comment.