diff --git a/tests/test_crypto_tools.py b/tests/test_crypto_tools.py index 7534f891a98a3c3663aeb585b54c137a0347a211..10c247210011d78c929799da30d69170fd91474d 100644 --- a/tests/test_crypto_tools.py +++ b/tests/test_crypto_tools.py @@ -38,7 +38,7 @@ def test_gen_checksum(pubkey, checksum): ( "J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX", "KA", - "Error: Wrong checksum for following public key: J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX", + "Error: public key 'J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX' does not match checksum 'KA'.\nPlease verify the public key.\n", ), ], ) @@ -49,7 +49,7 @@ def test_validate_checksum(pubkey, checksum, expected, capsys): else: with pytest.raises(SystemExit) as pytest_exit: test = crypto_tools.validate_checksum(pubkey_with_ck) - assert capsys.readouterr() == expected + assert capsys.readouterr().out == expected assert pytest_exit.type == SystemExit @@ -60,14 +60,14 @@ def test_validate_checksum(pubkey, checksum, expected, capsys): ("J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX:KAv", True, True), ("J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX", True, False), ("Youpi", False, None), - ("Youpi", True, "Error: bad format for following public key: Youpi"), + ("Youpi", True, "Error: bad format for following public key: Youpi\n"), ], ) def test_check_pubkey_format(pubkey, display_error, expected, capsys): if isinstance(expected, str): with pytest.raises(SystemExit) as pytest_exit: test = crypto_tools.check_pubkey_format(pubkey, display_error) - assert capsys.readouterr() == expected + assert capsys.readouterr().out == expected assert pytest_exit.type == SystemExit else: assert expected == crypto_tools.check_pubkey_format(pubkey, display_error) diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py index 57379c10f7ab981f0092d974f5f2325af62894cb..89278b6faac69649ff9a787f7e3d64977d14b030 100644 --- a/tests/test_unit_tx.py +++ b/tests/test_unit_tx.py @@ -193,7 +193,7 @@ def test_compute_amounts_errors(capsys): trial[1], ) assert pytest_exit.type == SystemExit - expected_error = "Error: amount {0} is too low.".format(trial[0][0]) + expected_error = "Error: amount {0} is too low.\n".format(trial[0][0]) assert capsys.readouterr().out == expected_error @@ -1347,9 +1347,9 @@ def test_check_transaction_values_errors( assert pytest_exit.type == SystemExit display = capsys.readouterr() if comment.find("Wrong_Char_") != -1: - assert display == "Error: the format of the comment is invalid" + assert display.out == "Error: the format of the comment is invalid\n" elif len(comment) > tx.MAX_COMMENT_LENGTH: - assert display == "Error: the format of the comment is invalid" + assert display.out == "Error: Comment is too long\n" elif "Wrong_Pubkey" in outputAddresses: assert display.out.find("Error: bad format for following public key:") != -1 elif outputBackChange: @@ -1360,7 +1360,6 @@ def test_check_transaction_values_errors( display.out.find("pubkey doesn’t have enough money for this transaction.") != -1 ) - assert result == "" # test generate_unlocks()