From 2a2a9e3b6040425c463c4fcb20f3af51707a7141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Palmer?= Date: Tue, 5 Nov 2024 11:18:36 +0100 Subject: [PATCH] [test] move operations tests --- .../nano/test_ensure_always_clearsign.py | 52 -------------- .../nano/test_sign/operations/__init__.py | 0 .../operations}/test_sign_ballot.py | 5 +- .../operations}/test_sign_delegation.py | 5 +- .../operations}/test_sign_failing_noop.py | 5 +- .../test_sign_increase_paid_storage.py | 5 +- .../operations}/test_sign_origination.py | 5 +- .../operations}/test_sign_proposals.py | 5 +- .../test_sign_register_global_constant.py | 5 +- .../operations}/test_sign_reveal.py | 5 +- .../test_sign_sc_rollup_add_messages.py | 5 +- ...t_sign_sc_rollup_execute_outbox_message.py | 5 +- .../test_sign_sc_rollup_originate.py | 5 +- .../test_sign_set_consensus_key.py | 5 +- .../test_sign_set_deposit_limit.py | 5 +- .../operations}/test_sign_transaction.py | 67 ++++++++++++++++++- .../operations/test_sign_transfer_ticket.py} | 40 +++++++++-- .../nano/test_sign_transfer_ticket.py | 53 --------------- .../nano/test_sign_with_long_hash.py | 52 -------------- 19 files changed, 140 insertions(+), 189 deletions(-) delete mode 100755 tests/integration/nano/test_ensure_always_clearsign.py create mode 100644 tests/integration/nano/test_sign/operations/__init__.py rename tests/integration/nano/{ => test_sign/operations}/test_sign_ballot.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_delegation.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_failing_noop.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_increase_paid_storage.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_origination.py (90%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_proposals.py (90%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_register_global_constant.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_reveal.py (90%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_sc_rollup_add_messages.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_sc_rollup_execute_outbox_message.py (91%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_sc_rollup_originate.py (93%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_set_consensus_key.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_set_deposit_limit.py (89%) rename tests/integration/nano/{ => test_sign/operations}/test_sign_transaction.py (72%) rename tests/integration/nano/{nanosp/test_nanosp_regression_potential_empty_screen.py => test_sign/operations/test_sign_transfer_ticket.py} (61%) delete mode 100755 tests/integration/nano/test_sign_transfer_ticket.py delete mode 100755 tests/integration/nano/test_sign_with_long_hash.py diff --git a/tests/integration/nano/test_ensure_always_clearsign.py b/tests/integration/nano/test_ensure_always_clearsign.py deleted file mode 100755 index 84f00c170..000000000 --- a/tests/integration/nano/test_ensure_always_clearsign.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2023 Functori - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Check clear signing never blindsign""" - -from pathlib import Path - -from utils.app import TezosAppScreen, DEFAULT_ACCOUNT -from utils.message import Transaction - -def test_ensure_always_clearsign(app: TezosAppScreen): - """Check clear signing never blindsign""" - test_name = Path(__file__).stem - - app.setup_expert_mode() - - message = Transaction( - source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', - fee = 10000, - counter = 2, - gas_limit = 3, - storage_limit = 4, - destination = 'KT18amZmM5W7qDWVt2pH6uj7sCEd3kbzLrHT', - amount = 0, - entrypoint = 'root', - parameter = [{'prim':'pair','args':[{'string':"["},{'prim':'pair','args':[{'string':"Z"},{'prim':'pair','args':[{'string':"Y"},{'prim':'pair','args':[{'string':"X"},{'prim':'pair','args':[{'string':"W"},{'prim':'pair','args':[{'string':"V"},{'prim':'pair','args':[{'string':"U"},{'prim':'pair','args':[{'string':"T"},{'prim':'pair','args':[{'string':"S"},{'prim':'pair','args':[{'string':"R"},{'prim':'pair','args':[{'string':"Q"},{'prim':'pair','args':[{'string':"P"},{'prim':'pair','args':[{'string':"O"},{'prim':'pair','args':[{'string':"N"},{'prim':'pair','args':[{'string':"M"},{'prim':'pair','args':[{'string':"L"},{'prim':'pair','args':[{'string':"K"},{'prim':'pair','args':[{'string':"J"},{'prim':'pair','args':[{'string':"I"},{'prim':'pair','args':[{'string':"H"},{'prim':'pair','args':[{'string':"G"},{'prim':'pair','args':[{'string':"F"},{'prim':'pair','args':[{'string':"E"},{'prim':'pair','args':[{'string':"D"},{'prim':'pair','args':[{'string':"C"},{'prim':'pair','args':[{'string':"B"},[]]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]},{'prim':'pair','args':[{'int':10},{'prim':'pair','args':[{'int':9},{'prim':'pair','args':[{'int':8},{'prim':'pair','args':[{'int':7},{'prim':'pair','args':[{'int':6},{'prim':'pair','args':[{'int':5},{'prim':'pair','args':[{'int':4},{'prim':'pair','args':[{'int':3},{'prim':'pair','args':[{'int':2},{'prim':'pair','args':[{'int':1},[]]}]}]}]}]}]}]}]}]}]}] - ) - - data = app.sign(DEFAULT_ACCOUNT, - message, - with_hash=True, - path=test_name) - - app.checker.check_signature( - account=DEFAULT_ACCOUNT, - message=message, - with_hash=True, - data=data) - - app.quit() diff --git a/tests/integration/nano/test_sign/operations/__init__.py b/tests/integration/nano/test_sign/operations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/integration/nano/test_sign_ballot.py b/tests/integration/nano/test_sign/operations/test_sign_ballot.py similarity index 89% rename from tests/integration/nano/test_sign_ballot.py rename to tests/integration/nano/test_sign/operations/test_sign_ballot.py index 30128cc30..3fa5def1b 100755 --- a/tests/integration/nano/test_sign_ballot.py +++ b/tests/integration/nano/test_sign/operations/test_sign_ballot.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing ballot""" +"""Gathering of tests related to Ballot operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_delegation.py b/tests/integration/nano/test_sign/operations/test_sign_delegation.py similarity index 89% rename from tests/integration/nano/test_sign_delegation.py rename to tests/integration/nano/test_sign/operations/test_sign_delegation.py index daa85df88..040b73c57 100755 --- a/tests/integration/nano/test_sign_delegation.py +++ b/tests/integration/nano/test_sign/operations/test_sign_delegation.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing delegation""" +"""Gathering of tests related to Delegation operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_failing_noop.py b/tests/integration/nano/test_sign/operations/test_sign_failing_noop.py similarity index 89% rename from tests/integration/nano/test_sign_failing_noop.py rename to tests/integration/nano/test_sign/operations/test_sign_failing_noop.py index 5bd24dc61..d3dd99a96 100755 --- a/tests/integration/nano/test_sign_failing_noop.py +++ b/tests/integration/nano/test_sign/operations/test_sign_failing_noop.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing failing noop""" +"""Gathering of tests related to Failing-noop operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_increase_paid_storage.py b/tests/integration/nano/test_sign/operations/test_sign_increase_paid_storage.py similarity index 89% rename from tests/integration/nano/test_sign_increase_paid_storage.py rename to tests/integration/nano/test_sign/operations/test_sign_increase_paid_storage.py index db4869180..59ed7e2f0 100755 --- a/tests/integration/nano/test_sign_increase_paid_storage.py +++ b/tests/integration/nano/test_sign/operations/test_sign_increase_paid_storage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing increase paid storage""" +"""Gathering of tests related to Increase-paid-storage operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_origination.py b/tests/integration/nano/test_sign/operations/test_sign_origination.py similarity index 90% rename from tests/integration/nano/test_sign_origination.py rename to tests/integration/nano/test_sign/operations/test_sign_origination.py index 49da3f640..eceda90c7 100755 --- a/tests/integration/nano/test_sign_origination.py +++ b/tests/integration/nano/test_sign/operations/test_sign_origination.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing origination""" +"""Gathering of tests related to Origination operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_proposals.py b/tests/integration/nano/test_sign/operations/test_sign_proposals.py similarity index 90% rename from tests/integration/nano/test_sign_proposals.py rename to tests/integration/nano/test_sign/operations/test_sign_proposals.py index ae29ca1f5..43d36fa7e 100755 --- a/tests/integration/nano/test_sign_proposals.py +++ b/tests/integration/nano/test_sign/operations/test_sign_proposals.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing proposals""" +"""Gathering of tests related to Proposals operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_register_global_constant.py b/tests/integration/nano/test_sign/operations/test_sign_register_global_constant.py similarity index 89% rename from tests/integration/nano/test_sign_register_global_constant.py rename to tests/integration/nano/test_sign/operations/test_sign_register_global_constant.py index 4ea36859e..51f043104 100755 --- a/tests/integration/nano/test_sign_register_global_constant.py +++ b/tests/integration/nano/test_sign/operations/test_sign_register_global_constant.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing register global constant""" +"""Gathering of tests related to Register-global-constant operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_reveal.py b/tests/integration/nano/test_sign/operations/test_sign_reveal.py similarity index 90% rename from tests/integration/nano/test_sign_reveal.py rename to tests/integration/nano/test_sign/operations/test_sign_reveal.py index ec5cbd15c..0aeb9f38d 100755 --- a/tests/integration/nano/test_sign_reveal.py +++ b/tests/integration/nano/test_sign/operations/test_sign_reveal.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing reveal""" +"""Gathering of tests related to Reveal operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_sc_rollup_add_messages.py b/tests/integration/nano/test_sign/operations/test_sign_sc_rollup_add_messages.py similarity index 89% rename from tests/integration/nano/test_sign_sc_rollup_add_messages.py rename to tests/integration/nano/test_sign/operations/test_sign_sc_rollup_add_messages.py index b89e97533..d212580ed 100755 --- a/tests/integration/nano/test_sign_sc_rollup_add_messages.py +++ b/tests/integration/nano/test_sign/operations/test_sign_sc_rollup_add_messages.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing smart rollup add message""" +"""Gathering of tests related to Smart-rollup Add-message operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_sc_rollup_execute_outbox_message.py b/tests/integration/nano/test_sign/operations/test_sign_sc_rollup_execute_outbox_message.py similarity index 91% rename from tests/integration/nano/test_sign_sc_rollup_execute_outbox_message.py rename to tests/integration/nano/test_sign/operations/test_sign_sc_rollup_execute_outbox_message.py index 5b80577e8..ae88ff2a8 100755 --- a/tests/integration/nano/test_sign_sc_rollup_execute_outbox_message.py +++ b/tests/integration/nano/test_sign/operations/test_sign_sc_rollup_execute_outbox_message.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing smart rollup execute outbox message""" +"""Gathering of tests related to Smart-rollup Execute-outbox operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_sc_rollup_originate.py b/tests/integration/nano/test_sign/operations/test_sign_sc_rollup_originate.py similarity index 93% rename from tests/integration/nano/test_sign_sc_rollup_originate.py rename to tests/integration/nano/test_sign/operations/test_sign_sc_rollup_originate.py index f10eacdda..778b13f1f 100755 --- a/tests/integration/nano/test_sign_sc_rollup_originate.py +++ b/tests/integration/nano/test_sign/operations/test_sign_sc_rollup_originate.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing smart rollup originate""" +"""Gathering of tests related to Smart-rollup Originate operations.""" from pathlib import Path from typing import List, Optional diff --git a/tests/integration/nano/test_sign_set_consensus_key.py b/tests/integration/nano/test_sign/operations/test_sign_set_consensus_key.py similarity index 89% rename from tests/integration/nano/test_sign_set_consensus_key.py rename to tests/integration/nano/test_sign/operations/test_sign_set_consensus_key.py index d5bf5be6c..c8f2932f5 100755 --- a/tests/integration/nano/test_sign_set_consensus_key.py +++ b/tests/integration/nano/test_sign/operations/test_sign_set_consensus_key.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing set consensus key""" +"""Gathering of tests related to Set-consensus-key operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_set_deposit_limit.py b/tests/integration/nano/test_sign/operations/test_sign_set_deposit_limit.py similarity index 89% rename from tests/integration/nano/test_sign_set_deposit_limit.py rename to tests/integration/nano/test_sign/operations/test_sign_set_deposit_limit.py index 4b2943f5c..d7b7b0189 100755 --- a/tests/integration/nano/test_sign_set_deposit_limit.py +++ b/tests/integration/nano/test_sign/operations/test_sign_set_deposit_limit.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing set deposit limit""" +"""Gathering of tests related to Set-deposit-limit operations.""" from pathlib import Path diff --git a/tests/integration/nano/test_sign_transaction.py b/tests/integration/nano/test_sign/operations/test_sign_transaction.py similarity index 72% rename from tests/integration/nano/test_sign_transaction.py rename to tests/integration/nano/test_sign/operations/test_sign_transaction.py index 787c6ed8d..699acfbd0 100755 --- a/tests/integration/nano/test_sign_transaction.py +++ b/tests/integration/nano/test_sign/operations/test_sign_transaction.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing transaction""" +"""Gathering of tests related to Transaction operations.""" from pathlib import Path @@ -263,3 +264,65 @@ def test_sign_set_delegate_parameters_transaction(app: TezosAppScreen): data=data) app.quit() + +def test_sign_with_long_hash(app: TezosAppScreen): + """Check signing transaction with a long destination hash""" + test_name = "test_sign_with_long_hash" + + app.setup_expert_mode() + + message = Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 10000, + counter = 2, + gas_limit = 3, + storage_limit = 4, + destination = 'KT1GW4QHn66m7WWWMWCMNaWmGYpCRbg5ahwU', + amount = 0, + entrypoint = 'root', + parameter = {'int': 0} + ) + + data = app.sign(DEFAULT_ACCOUNT, + message, + with_hash=True, + path=test_name) + + app.checker.check_signature( + account=DEFAULT_ACCOUNT, + message=message, + with_hash=True, + data=data) + + app.quit() + +def test_ensure_always_clearsign(app: TezosAppScreen): + """Check clear signing never blindsign""" + test_name = "test_ensure_always_clearsign" + + app.setup_expert_mode() + + message = Transaction( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 10000, + counter = 2, + gas_limit = 3, + storage_limit = 4, + destination = 'KT18amZmM5W7qDWVt2pH6uj7sCEd3kbzLrHT', + amount = 0, + entrypoint = 'root', + parameter = [{'prim':'pair','args':[{'string':"["},{'prim':'pair','args':[{'string':"Z"},{'prim':'pair','args':[{'string':"Y"},{'prim':'pair','args':[{'string':"X"},{'prim':'pair','args':[{'string':"W"},{'prim':'pair','args':[{'string':"V"},{'prim':'pair','args':[{'string':"U"},{'prim':'pair','args':[{'string':"T"},{'prim':'pair','args':[{'string':"S"},{'prim':'pair','args':[{'string':"R"},{'prim':'pair','args':[{'string':"Q"},{'prim':'pair','args':[{'string':"P"},{'prim':'pair','args':[{'string':"O"},{'prim':'pair','args':[{'string':"N"},{'prim':'pair','args':[{'string':"M"},{'prim':'pair','args':[{'string':"L"},{'prim':'pair','args':[{'string':"K"},{'prim':'pair','args':[{'string':"J"},{'prim':'pair','args':[{'string':"I"},{'prim':'pair','args':[{'string':"H"},{'prim':'pair','args':[{'string':"G"},{'prim':'pair','args':[{'string':"F"},{'prim':'pair','args':[{'string':"E"},{'prim':'pair','args':[{'string':"D"},{'prim':'pair','args':[{'string':"C"},{'prim':'pair','args':[{'string':"B"},[]]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]},{'prim':'pair','args':[{'int':10},{'prim':'pair','args':[{'int':9},{'prim':'pair','args':[{'int':8},{'prim':'pair','args':[{'int':7},{'prim':'pair','args':[{'int':6},{'prim':'pair','args':[{'int':5},{'prim':'pair','args':[{'int':4},{'prim':'pair','args':[{'int':3},{'prim':'pair','args':[{'int':2},{'prim':'pair','args':[{'int':1},[]]}]}]}]}]}]}]}]}]}]}] + ) + + data = app.sign(DEFAULT_ACCOUNT, + message, + with_hash=True, + path=test_name) + + app.checker.check_signature( + account=DEFAULT_ACCOUNT, + message=message, + with_hash=True, + data=data) + + app.quit() diff --git a/tests/integration/nano/nanosp/test_nanosp_regression_potential_empty_screen.py b/tests/integration/nano/test_sign/operations/test_sign_transfer_ticket.py similarity index 61% rename from tests/integration/nano/nanosp/test_nanosp_regression_potential_empty_screen.py rename to tests/integration/nano/test_sign/operations/test_sign_transfer_ticket.py index 9bc45532b..f10eb5a8b 100755 --- a/tests/integration/nano/nanosp/test_nanosp_regression_potential_empty_screen.py +++ b/tests/integration/nano/test_sign/operations/test_sign_transfer_ticket.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2023 Functori +# Copyright 2024 Functori +# Copyright 2024 Trilitech # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,19 +14,50 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Check signing operation that display potentially empty screens""" +"""Gathering of tests related to Transfer-ticket operations.""" from pathlib import Path from conftest import requires_device - from utils.app import TezosAppScreen, DEFAULT_ACCOUNT from utils.message import TransferTicket +def test_sign_transfer_ticket(app: TezosAppScreen): + """Check signing transfer ticket""" + test_name = Path(__file__).stem + + app.setup_expert_mode() + + message = TransferTicket( + source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + fee = 10000, + counter = 2, + gas_limit = 3, + storage_limit = 4, + ticket_contents = {'prim': 'UNPAIR'}, + ticket_ty = {'prim': 'pair', 'args': [{'string': '1'}, {'int': 2}]}, + ticket_ticketer = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', + ticket_amount = 1, + destination = 'KT18amZmM5W7qDWVt2pH6uj7sCEd3kbzLrHT' + ) + + data = app.sign(DEFAULT_ACCOUNT, + message, + with_hash=True, + path=test_name) + + app.checker.check_signature( + account=DEFAULT_ACCOUNT, + message=message, + with_hash=True, + data=data) + + app.quit() + @requires_device("nanosp") def test_nanosp_regression_potential_empty_screen(app: TezosAppScreen): """Check signing operation that display potentially empty screens""" - test_name = Path(__file__).stem + test_name = "test_nanosp_regression_potential_empty_screen" app.setup_expert_mode() diff --git a/tests/integration/nano/test_sign_transfer_ticket.py b/tests/integration/nano/test_sign_transfer_ticket.py deleted file mode 100755 index 0712588b1..000000000 --- a/tests/integration/nano/test_sign_transfer_ticket.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2023 Functori - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Check signing transfer ticket""" - -from pathlib import Path - -from utils.app import TezosAppScreen, DEFAULT_ACCOUNT -from utils.message import TransferTicket - -def test_sign_transfer_ticket(app: TezosAppScreen): - """Check signing transfer ticket""" - test_name = Path(__file__).stem - - app.setup_expert_mode() - - message = TransferTicket( - source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', - fee = 10000, - counter = 2, - gas_limit = 3, - storage_limit = 4, - ticket_contents = {'prim': 'UNPAIR'}, - ticket_ty = {'prim': 'pair', 'args': [{'string': '1'}, {'int': 2}]}, - ticket_ticketer = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', - ticket_amount = 1, - destination = 'KT18amZmM5W7qDWVt2pH6uj7sCEd3kbzLrHT' - ) - - data = app.sign(DEFAULT_ACCOUNT, - message, - with_hash=True, - path=test_name) - - app.checker.check_signature( - account=DEFAULT_ACCOUNT, - message=message, - with_hash=True, - data=data) - - app.quit() diff --git a/tests/integration/nano/test_sign_with_long_hash.py b/tests/integration/nano/test_sign_with_long_hash.py deleted file mode 100755 index 7c4540986..000000000 --- a/tests/integration/nano/test_sign_with_long_hash.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2023 Functori - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Check signing transaction with a long destination hash""" - -from pathlib import Path - -from utils.app import TezosAppScreen, DEFAULT_ACCOUNT -from utils.message import Transaction - -def test_sign_with_long_hash(app: TezosAppScreen): - """Check signing transaction with a long destination hash""" - test_name = Path(__file__).stem - - app.setup_expert_mode() - - message = Transaction( - source = 'tz1ixvCiPJYyMjsp2nKBVaq54f6AdbV8hCKa', - fee = 10000, - counter = 2, - gas_limit = 3, - storage_limit = 4, - destination = 'KT1GW4QHn66m7WWWMWCMNaWmGYpCRbg5ahwU', - amount = 0, - entrypoint = 'root', - parameter = {'int': 0} - ) - - data = app.sign(DEFAULT_ACCOUNT, - message, - with_hash=True, - path=test_name) - - app.checker.check_signature( - account=DEFAULT_ACCOUNT, - message=message, - with_hash=True, - data=data) - - app.quit()