Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tests/transactions/validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from tests.helpers import random_encoded_account_number

from thenewboston.transactions.validation import validate_transaction_exists


def test_validate_transaction_exists():
account = random_encoded_account_number()
amount = 1
fee = 1
error = RuntimeError
transactions = [
{
'amount': amount,
'fee': fee,
'recipient': account,
},
{
'amount': 2,
'fee': fee,
'recipient': account,
},
]
try:
validate_transaction_exists(amount=amount, fee=fee, error=error, recipient=account, txs=transactions)
validate_transaction_exists(amount=amount + 1, fee=fee, error=error, recipient=account, txs=transactions)
assert True
except error:
raise AssertionError()
try:
validate_transaction_exists(amount=amount, fee=3, error=error, recipient=account, txs=transactions)
validate_transaction_exists(amount=amount, fee=fee, error=error, recipient=random_encoded_account_number(), txs=transactions)
assert AssertionError()
except error:
assert True