diff options
Diffstat (limited to 'tests/functional_tests')
23 files changed, 76 insertions, 35 deletions
diff --git a/tests/functional_tests/CMakeLists.txt b/tests/functional_tests/CMakeLists.txt index 702ccc646..6972be55f 100644 --- a/tests/functional_tests/CMakeLists.txt +++ b/tests/functional_tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2019, The Monero Project +# Copyright (c) 2014-2020, The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/address_book.py b/tests/functional_tests/address_book.py index f9ec217af..37a5915c9 100755 --- a/tests/functional_tests/address_book.py +++ b/tests/functional_tests/address_book.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 #encoding=utf-8 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # @@ -145,7 +145,7 @@ class AddressBookTest(): res = wallet.get_address_book() assert len(res.entries) == 1 e = res.entries[0] - assert e.address == '44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A' + assert e.address == '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H' assert e.description == 'dev fund' # UTF-8 @@ -173,7 +173,7 @@ class AddressBookTest(): # get them back res = wallet.get_address_book([0]) assert len(res.entries) == 1 - assert res.entries[0].address == '44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A' + assert res.entries[0].address == '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H' assert res.entries[0].description == 'dev fund' res = wallet.get_address_book([1]) assert len(res.entries) == 1 @@ -213,12 +213,12 @@ class AddressBookTest(): assert e.index == 1 assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' assert e.description == u'えんしゅう' - res = wallet.edit_address_book(1, address = '44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A') + res = wallet.edit_address_book(1, address = '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H') res = wallet.get_address_book([1]) assert len(res.entries) == 1 e = res.entries[0] assert e.index == 1 - assert e.address == '44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A' + assert e.address == '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H' assert e.description == u'えんしゅう' ok = False try: res = wallet.edit_address_book(1, address = '') @@ -237,7 +237,7 @@ class AddressBookTest(): wallet.delete_address_book(0) res = wallet.get_address_book([0]) # entries above the deleted one collapse one slot up assert len(res.entries) == 1 - assert res.entries[0].address == '44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A' + assert res.entries[0].address == '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H' assert res.entries[0].description == u'えんしゅう' wallet.delete_address_book(2) wallet.delete_address_book(0) diff --git a/tests/functional_tests/bans.py b/tests/functional_tests/bans.py index e859e58c9..3e265a11e 100755 --- a/tests/functional_tests/bans.py +++ b/tests/functional_tests/bans.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/check_missing_rpc_methods.py b/tests/functional_tests/check_missing_rpc_methods.py index 6fadebf9b..0eedd6d0f 100644 --- a/tests/functional_tests/check_missing_rpc_methods.py +++ b/tests/functional_tests/check_missing_rpc_methods.py @@ -46,5 +46,6 @@ for module in modules: name = name[1:] if not hasattr(module['object'], name): print('Error: %s API method %s does not have a matching function' % (module['name'], name)) + error = True sys.exit(1 if error else 0) diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py index 698217436..35e00e105 100755 --- a/tests/functional_tests/cold_signing.py +++ b/tests/functional_tests/cold_signing.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/get_output_distribution.py b/tests/functional_tests/get_output_distribution.py index 077b094ba..24b6e9008 100755 --- a/tests/functional_tests/get_output_distribution.py +++ b/tests/functional_tests/get_output_distribution.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/integrated_address.py b/tests/functional_tests/integrated_address.py index 4e42261a6..c3b730de0 100755 --- a/tests/functional_tests/integrated_address.py +++ b/tests/functional_tests/integrated_address.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/main.cpp b/tests/functional_tests/main.cpp index c6869f755..8d140f721 100644 --- a/tests/functional_tests/main.cpp +++ b/tests/functional_tests/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2019, The Monero Project +// Copyright (c) 2014-2020, The Monero Project // // All rights reserved. // diff --git a/tests/functional_tests/make_test_signature.cc b/tests/functional_tests/make_test_signature.cc index f31816841..07cc3eea6 100644 --- a/tests/functional_tests/make_test_signature.cc +++ b/tests/functional_tests/make_test_signature.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019, The Monero Project +// Copyright (c) 2019-2020, The Monero Project // // All rights reserved. // diff --git a/tests/functional_tests/multisig.py b/tests/functional_tests/multisig.py index e4e908aa1..0a58f469a 100755 --- a/tests/functional_tests/multisig.py +++ b/tests/functional_tests/multisig.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/proofs.py b/tests/functional_tests/proofs.py index 7beb3ec6e..e58d29f94 100755 --- a/tests/functional_tests/proofs.py +++ b/tests/functional_tests/proofs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # @@ -130,13 +130,13 @@ class ProofsTest(): sending_address = '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' receiving_address = '44Kbx4sJ7JDRDV5aAhLJzQCjDz2ViLRduE3ijDZu3osWKBjMGkV1XPk4pfDUMqt1Aiezvephdqm6YD19GKFD9ZcXVUTp6BW' res = self.wallet[0].get_tx_proof(txid, sending_address, 'foo'); - assert res.signature.startswith('InProof'); + assert res.signature.startswith('InProofV2'); signature0i = res.signature res = self.wallet[0].get_tx_proof(txid, receiving_address, 'bar'); - assert res.signature.startswith('OutProof'); + assert res.signature.startswith('OutProofV2'); signature0o = res.signature res = self.wallet[1].get_tx_proof(txid, receiving_address, 'baz'); - assert res.signature.startswith('InProof'); + assert res.signature.startswith('InProofV2'); signature1 = res.signature res = self.wallet[0].check_tx_proof(txid, sending_address, 'foo', signature0i); @@ -219,6 +219,23 @@ class ProofsTest(): except: ok = True assert ok or not res.good + + # Test bad cross-version verification + ok = False + try: res = self.wallet[0].check_tx_proof(txid, sending_address, 'foo', signature0i.replace('ProofV2','ProofV1')); + except: ok = True + assert ok or not res.good + + ok = False + try: res = self.wallet[0].check_tx_proof(txid, receiving_address, 'bar', signature0o.replace('ProofV2','ProofV1')); + except: ok = True + assert ok or not res.good + + ok = False + try: res = self.wallet[1].check_tx_proof(txid, receiving_address, 'baz', signature1.replace('ProofV2','ProofV1')); + except: ok = True + assert ok or not res.good + def check_spend_proof(self, txid): daemon = Daemon() @@ -270,7 +287,7 @@ class ProofsTest(): balance1 = res.balance res = self.wallet[0].get_reserve_proof(all_ = True, message = 'foo') - assert res.signature.startswith('ReserveProof') + assert res.signature.startswith('ReserveProofV2') signature = res.signature for i in range(2): res = self.wallet[i].check_reserve_proof(address = address0, message = 'foo', signature = signature) @@ -287,9 +304,15 @@ class ProofsTest(): except: ok = True assert ok or not res.good + # Test bad cross-version verification + ok = False + try: res = self.wallet[i].check_reserve_proof(address = address0, message = 'foo', signature = signature.replace('ProofV2','ProofV1')) + except: ok = True + assert ok or not res.good + amount = int(balance0 / 10) res = self.wallet[0].get_reserve_proof(all_ = False, amount = amount, message = 'foo') - assert res.signature.startswith('ReserveProof') + assert res.signature.startswith('ReserveProofV2') signature = res.signature for i in range(2): res = self.wallet[i].check_reserve_proof(address = address0, message = 'foo', signature = signature) @@ -306,6 +329,12 @@ class ProofsTest(): except: ok = True assert ok or not res.good + # Test bad cross-version verification + ok = False + try: res = self.wallet[i].check_reserve_proof(address = address0, message = 'foo', signature = signature.replace('ProofV2','ProofV1')) + except: ok = True + assert ok or not res.good + ok = False try: self.wallet[0].get_reserve_proof(all_ = False, amount = balance0 + 1, message = 'foo') except: ok = True diff --git a/tests/functional_tests/rpc_payment.py b/tests/functional_tests/rpc_payment.py index 5f23c2022..d0f9c2913 100755 --- a/tests/functional_tests/rpc_payment.py +++ b/tests/functional_tests/rpc_payment.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/sign_message.py b/tests/functional_tests/sign_message.py index 9dd70f8bc..7ce2f2c18 100755 --- a/tests/functional_tests/sign_message.py +++ b/tests/functional_tests/sign_message.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/speed.py b/tests/functional_tests/speed.py index 71be785b8..c0c1d23c2 100755 --- a/tests/functional_tests/speed.py +++ b/tests/functional_tests/speed.py @@ -67,7 +67,7 @@ class SpeedTest(): destinations = [] for i in range(3): - destinations.append({"amount":1,"address":'44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A'}) + destinations.append({"amount":1,"address":'888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H'}) self._test_speed_generateblocks(daemon=daemon, blocks=70) for i in range(1, 10): @@ -89,7 +89,7 @@ class SpeedTest(): print('Test speed of transfer') start = time.time() - destinations = [{"amount":1,"address":'44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A'}] + destinations = [{"amount":1,"address":'888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H'}] res = wallet.transfer_split(destinations) print('generating tx took: ', time.time() - start, 'seconds') diff --git a/tests/functional_tests/transactions_flow_test.cpp b/tests/functional_tests/transactions_flow_test.cpp index 218590a27..cec6825f5 100644 --- a/tests/functional_tests/transactions_flow_test.cpp +++ b/tests/functional_tests/transactions_flow_test.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2019, The Monero Project +// Copyright (c) 2014-2020, The Monero Project // // All rights reserved. // diff --git a/tests/functional_tests/transactions_flow_test.h b/tests/functional_tests/transactions_flow_test.h index 530400df8..8e2dfd92c 100644 --- a/tests/functional_tests/transactions_flow_test.h +++ b/tests/functional_tests/transactions_flow_test.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2019, The Monero Project +// Copyright (c) 2014-2020, The Monero Project // // All rights reserved. // diff --git a/tests/functional_tests/transactions_generation_from_blockchain.cpp b/tests/functional_tests/transactions_generation_from_blockchain.cpp index b9c43e0e9..3ba401529 100644 --- a/tests/functional_tests/transactions_generation_from_blockchain.cpp +++ b/tests/functional_tests/transactions_generation_from_blockchain.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2019, The Monero Project +// Copyright (c) 2014-2020, The Monero Project // // All rights reserved. // diff --git a/tests/functional_tests/transactions_generation_from_blockchain.h b/tests/functional_tests/transactions_generation_from_blockchain.h index cb5f94f80..70a2486d6 100644 --- a/tests/functional_tests/transactions_generation_from_blockchain.h +++ b/tests/functional_tests/transactions_generation_from_blockchain.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2019, The Monero Project +// Copyright (c) 2014-2020, The Monero Project // // All rights reserved. // diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index c3d71aa9c..132758f50 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/txpool.py b/tests/functional_tests/txpool.py index 27ae89764..e886200da 100755 --- a/tests/functional_tests/txpool.py +++ b/tests/functional_tests/txpool.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # @@ -241,6 +241,17 @@ class TransferTest(): assert x.fee == txes[txid].fee assert x.tx_blob == txes[txid].tx_blob + print('Checking relaying txes') + res = daemon.get_transaction_pool_hashes() + assert len(res.tx_hashes) > 0 + txid = res.tx_hashes[0] + daemon.relay_tx([txid]) + res = daemon.get_transactions([txid]) + assert len(res.txs) == 1 + assert res.txs[0].tx_hash == txid + assert res.txs[0].in_pool + assert res.txs[0].relayed + daemon.flush_txpool() self.check_empty_pool() diff --git a/tests/functional_tests/uri.py b/tests/functional_tests/uri.py index f759b316a..c193ac926 100755 --- a/tests/functional_tests/uri.py +++ b/tests/functional_tests/uri.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 #encoding=utf-8 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # diff --git a/tests/functional_tests/validate_address.py b/tests/functional_tests/validate_address.py index 7c3d8abfa..d201cdf68 100755 --- a/tests/functional_tests/validate_address.py +++ b/tests/functional_tests/validate_address.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # @@ -94,7 +94,7 @@ class AddressValidationTest(): def check_openalias_addresses(self): print('Validating openalias addresses') addresses = [ - ['donate@getmonero.org', '44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A'] + ['donate@getmonero.org', '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H'] ] for address in addresses: res = self.wallet.validate_address(address[0]) @@ -102,7 +102,7 @@ class AddressValidationTest(): res = self.wallet.validate_address(address[0], allow_openalias = True) assert res.valid assert not res.integrated - assert not res.subaddress + assert res.subaddress assert res.nettype == 'mainnet' assert res.openalias_address == address[1] diff --git a/tests/functional_tests/wallet.py b/tests/functional_tests/wallet.py index 5bb3ec80a..91164daf9 100755 --- a/tests/functional_tests/wallet.py +++ b/tests/functional_tests/wallet.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 #encoding=utf-8 -# Copyright (c) 2019 The Monero Project +# Copyright (c) 2019-2020 The Monero Project # # All rights reserved. # |