Skip to content

Commit

Permalink
Tests: update with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Apr 26, 2024
1 parent e3317c6 commit 5a5629c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
23 changes: 15 additions & 8 deletions tests/ragger_bitcoin/ragger_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,37 @@ def navigate_end_of_flow(self, save_screenshot=True):
self.new_request("Processing", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP,
save_screenshot=save_screenshot)

def confirm_transaction(self, save_screenshot=True):
self.new_request("Sign", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM,
def review_start(self, output_count: int = 1, save_screenshot=True):
self.new_request("Review", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP,
save_screenshot=save_screenshot)
self.new_request("TRANSACTION", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS,
for _ in range(0, output_count):
self.same_request("Amount", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP,
save_screenshot=save_screenshot)
def review_fees(self, fees_on_same_request: bool = True, save_screenshot=True):
if fees_on_same_request:
self.same_request("Fees", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP,
save_screenshot=save_screenshot)
else:
self.new_request("Fees", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_TAP,
save_screenshot=save_screenshot)

def same_request_confirm_transaction(self, save_screenshot=True):
def confirm_transaction(self, save_screenshot=True):
self.same_request("Sign", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM,
save_screenshot=save_screenshot)
self.new_request("TRANSACTION", NavInsID.USE_CASE_REVIEW_TAP,
self.new_request("Transaction", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS,
save_screenshot=save_screenshot)

def confirm_message(self, save_screenshot=True):
self.new_request("Sign", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_REVIEW_CONFIRM, save_screenshot=save_screenshot)
self.new_request("MESSAGE", NavInsID.USE_CASE_REVIEW_TAP,
self.new_request("Message", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS, save_screenshot=save_screenshot)

def confirm_wallet(self, save_screenshot=True):
self.new_request("Approve", NavInsID.USE_CASE_REVIEW_TAP, NavInsID.USE_CASE_REVIEW_CONFIRM,
save_screenshot=save_screenshot)
self.same_request("WALLET", NavInsID.USE_CASE_REVIEW_TAP,
self.same_request("Wallet", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS, save_screenshot=save_screenshot)

def reject_message(self, save_screenshot=True):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_get_pubkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def pubkey_instruction_approve(model: Firmware) -> Instructions:
instructions.new_request("Approve")
else:
instructions.address_confirm()
instructions.same_request("ADDRESS", NavInsID.USE_CASE_REVIEW_TAP,
instructions.same_request("Address", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS)
return instructions

Expand All @@ -24,11 +24,11 @@ def pubkey_instruction_warning_approve(model: Firmware) -> Instructions:
instructions.new_request("Approve")
instructions.same_request("Approve")
else:
instructions.new_request("Unusual", NavInsID.USE_CASE_REVIEW_TAP,
instructions.new_request("Unusual", NavInsID.USE_CASE_CHOICE_CONFIRM,
NavInsID.USE_CASE_CHOICE_CONFIRM)
instructions.same_request("Confirm", NavInsID.USE_CASE_ADDRESS_CONFIRMATION_TAP,
NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM)
instructions.same_request("ADDRESS", NavInsID.USE_CASE_REVIEW_TAP,
instructions.same_request("Address", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS)
return instructions

Expand Down
5 changes: 4 additions & 1 deletion tests/test_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def sign_psbt_instruction_approve(model: Firmware) -> Instructions:
instructions.new_request("Accept")
instructions.same_request("Accept")
else:
instructions.review_start()
instructions.review_fees()
instructions.confirm_transaction()
return instructions

Expand All @@ -32,7 +34,8 @@ def sign_psbt_instruction_approve_2(model: Firmware) -> Instructions:
instructions.new_request("Accept")
instructions.new_request("Accept")
else:
instructions.navigate_end_of_flow()
instructions.review_start()
instructions.review_fees(fees_on_same_request=False)
instructions.confirm_transaction()
return instructions

Expand Down
2 changes: 1 addition & 1 deletion tests/test_sign_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def message_instruction_approve(model: Firmware) -> Instructions:
instructions.same_request("Sign")
else:
instructions.address_confirm()
instructions.same_request("ADDRESS", NavInsID.USE_CASE_REVIEW_TAP,
instructions.same_request("Address", NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_STATUS_DISMISS)
instructions.confirm_message()
return instructions
Expand Down

0 comments on commit 5a5629c

Please sign in to comment.