Skip to content
Snippets Groups Projects
Commit a0627ee3 authored by Vincent Texier's avatar Vincent Texier
Browse files

[enh] #798 fix tests and add unit tests on lock_mode

parent 53b3dce8
No related branches found
No related tags found
1 merge request!778Release 0.51.0
......@@ -43,6 +43,7 @@ async def test_send_more_than_40_sources(
amount_before_send,
0,
"Test comment",
0,
)
assert transactions[0].comment == "[CHAINED]"
assert transactions[1].comment == "Test comment"
......
......@@ -83,7 +83,7 @@ async def test_send_tx_then_cancel(
)
fake_server_with_blockchain.reject_next_post = True
await application_with_one_connection.documents_service.send_money(
bob_connection, bob.salt, bob.password, alice.key.pubkey, 10, 0, "Test comment"
bob_connection, bob.salt, bob.password, alice.key.pubkey, 10, 0, None, 0
)
tx_after_send = application_with_one_connection.transactions_service.transfers(
bob.key.pubkey
......
......@@ -18,7 +18,7 @@ async def test_send_tx_then_validate(
pubkey=bob.key.pubkey
)
await application_with_one_connection.documents_service.send_money(
bob_connection, bob.salt, bob.password, alice.key.pubkey, 10, 0, "Test comment"
bob_connection, bob.salt, bob.password, alice.key.pubkey, 10, 0, None, 0
)
tx_after_send = application_with_one_connection.transactions_service.transfers(
bob.key.pubkey
......
import pytest
@pytest.mark.asyncio
async def test_lock_mode_0(application_with_one_connection, fake_server, bob, alice):
"""
Test the lock mode 0, Receiver signature
:param application_with_one_connection:
:param fake_server:
:param bob:
:param alice:
:return:
"""
# check money amount in bob account
amount = application_with_one_connection.sources_service.amount(bob.key.pubkey)
assert amount == 1584
# create connection to have sources...
bob_connection = application_with_one_connection.db.connections_repo.get_one(
pubkey=bob.key.pubkey
)
# send transaction
(
_,
sakia_tx_list,
) = await application_with_one_connection.documents_service.send_money(
bob_connection, bob.salt, bob.password, alice.key.pubkey, 100, 0, None, 0
)
assert len(sakia_tx_list) == 1
assert (
"Outputs:\n100:0:SIG(F3HWkYnUSbdpEueosKqzYd1m8ftwojwE2uXR7ScoAVKo)\n"
in sakia_tx_list[0].raw
)
@pytest.mark.asyncio
async def test_lock_mode_1(application_with_one_connection, fake_server, bob, alice):
"""
Test the lock mode 0, Receiver signature OR (Sender signature AND CSV(one week delay))
:param application_with_one_connection:
:param fake_server:
:param bob:
:param alice:
:return:
"""
# check money amount in bob account
amount = application_with_one_connection.sources_service.amount(bob.key.pubkey)
assert amount == 1584
# create connection to have sources...
bob_connection = application_with_one_connection.db.connections_repo.get_one(
pubkey=bob.key.pubkey
)
# send transaction
(
_,
sakia_tx_list,
) = await application_with_one_connection.documents_service.send_money(
bob_connection, bob.salt, bob.password, alice.key.pubkey, 100, 0, None, 1
)
assert len(sakia_tx_list) == 1
assert (
"Outputs:\n100:0:SIG(F3HWkYnUSbdpEueosKqzYd1m8ftwojwE2uXR7ScoAVKo) || (SIG(GfFUvqaVSgCt6nFDQCAuULWk6K16MUDckeyBJQFcaYj7) && CSV(604800))\n"
in sakia_tx_list[0].raw
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment