Skip to content

Commit

Permalink
Update: tests outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
meherett committed Sep 10, 2020
1 parent f6fc4d4 commit 4b3e76c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
15 changes: 8 additions & 7 deletions tests/pybytom/transaction/test_advanced_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@

from pybytom.transaction import AdvancedTransaction
from pybytom.transaction.actions import spend_utxo, control_address
from pybytom.transaction.tools import find_smart_contract_utxo
from pybytom.transaction.tools import find_smart_contract_utxo, find_p2wsh_utxo

NETWORK = "mainnet"

ASSET = "f37dea62efd2965174b84bbb59a0bd0a671cf5fb2857303ffd77c1b482b84bdf"
ASSET = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"


def test_advanced_transaction():

unsigned_advanced_transaction = AdvancedTransaction(network=NETWORK)
unsigned_advanced_transaction.build_transaction(
guid="f0ed6ddd-9d6b-49fd-8866-a52d1083a13b",
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7",
inputs=[
spend_utxo(
utxo=find_smart_contract_utxo(
transaction_id="5268c5a52f22141521833d79ad69c27a2760e99cb0f8386c3e02cf5d1bb0832f",
utxo=find_p2wsh_utxo(
transaction_id="049d4c26bb15885572c16e0eefac5b2f4d0fde50eaf90f002272d39507ff315b",
network=NETWORK
)
)
],
outputs=[
control_address(
asset=ASSET,
amount=100,
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7"
amount=10_000_000,
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7",
symbol="NEU"
)
],
fee=10_000_000,
Expand Down
2 changes: 1 addition & 1 deletion tests/pybytom/transaction/test_normal_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_normal_transaction():

unsigned_normal_transaction = NormalTransaction(network=NETWORK)
unsigned_normal_transaction.build_transaction(
guid="f0ed6ddd-9d6b-49fd-8866-a52d1083a13b",
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7",
recipients={
"bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7": 1_000_000
},
Expand Down
13 changes: 7 additions & 6 deletions tests/pybytom/transaction/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@

NETWORK = "mainnet"

ASSET = "f37dea62efd2965174b84bbb59a0bd0a671cf5fb2857303ffd77c1b482b84bdf"
ASSET = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"


def test_transaction():

unsigned_transaction = Transaction(network=NETWORK)
unsigned_transaction.build_transaction(
guid="f0ed6ddd-9d6b-49fd-8866-a52d1083a13b",
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7",
inputs=[
spend_utxo(
utxo=find_smart_contract_utxo(
transaction_id="5268c5a52f22141521833d79ad69c27a2760e99cb0f8386c3e02cf5d1bb0832f",
utxo=find_p2wsh_utxo(
transaction_id="049d4c26bb15885572c16e0eefac5b2f4d0fde50eaf90f002272d39507ff315b",
network=NETWORK
)
)
],
outputs=[
control_address(
asset=ASSET,
amount=100,
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7"
amount=10_000_000,
address="bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7",
symbol="NEU"
)
],
fee=10_000_000,
Expand Down
5 changes: 3 additions & 2 deletions tests/pybytom/wallet/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pybytom.wallet import Wallet
from pybytom.utils import is_mnemonic, generate_entropy
from pybytom.wallet.utils import get_bytes, bad_seed_checker
from pybytom.exceptions import NetworkError, DerivationError

import hashlib
import pytest
Expand Down Expand Up @@ -45,7 +46,7 @@ def test_wallet_errors():

with pytest.raises(TypeError, match="network must be string format"):
Wallet(123)
with pytest.raises(ValueError, match=r"invalid network option, .*"):
with pytest.raises(NetworkError, match=r"Invalid 'meheretnet' network/type, .*"):
Wallet("meheretnet")

# from entropy
Expand Down Expand Up @@ -77,7 +78,7 @@ def test_wallet_errors():
# from path
with pytest.raises(TypeError, match="path must be string format"):
Wallet("solonet").from_path(int())
with pytest.raises(ValueError, match=r"bad path, insert like this type of path .*"):
with pytest.raises(DerivationError, match=r"Bad path, insert like this type of path .*"):
Wallet("mainnet").from_path("mm/")
# address
with pytest.raises(TypeError, match="network must be string format"):
Expand Down

0 comments on commit 4b3e76c

Please sign in to comment.