Skip to content
Snippets Groups Projects
Commit ca5b662f authored by matograine's avatar matograine
Browse files

[test] create fake_block_uid to mock a block uid.

  * make test_membership.py use it
  * make test_generate_transaction_document use it
parent 3e051e9f
No related branches found
No related tags found
1 merge request!130#213: Write unit tests for the transaction command
......@@ -12,6 +12,10 @@ mocked_block = {
"hash": "0000010D30B1284D34123E036B7BE0A449AE9F2B928A77D7D20E3BDEAC7EE14C",
}
fake_block_uid = BlockUID(
48000, "0000010D30B1284D34123E036B7BE0A449AE9F2B928A77D7D20E3BDEAC7EE14C"
)
async def patched_params(self):
return {
......
......@@ -32,6 +32,7 @@ from patched.blockchain_tools import (
patched_params,
patched_block,
patched_head_block,
fake_block_uid,
)
from patched.wot import (
patched_wot_requirements_one_pending,
......@@ -62,9 +63,7 @@ identity_timestamp = block_uid(
"0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
)
identity_uid = "toto"
membership_timestamp = block_uid(
"48000-0000010D30B1284D34123E036B7BE0A449AE9F2B928A77D7D20E3BDEAC7EE14C"
)
membership_timestamp = fake_block_uid
def patched_auth_method():
......
......@@ -31,13 +31,12 @@ from duniterpy.documents.transaction import (
Unlock,
SIGParameter,
)
from duniterpy.documents.block_uid import BlockUID
from patched.wot import patched_is_member
from patched.money import patched_get_sources, patched_ud_value
from patched.test_constants import mock_ud_value
from patched.tools import patched_currency_symbol
from patched.blockchain_tools import patched_head_block
from patched.blockchain_tools import patched_head_block, fake_block_uid
# truncBase()
......@@ -309,9 +308,7 @@ async def test_transaction_amount(
result1 = Transaction(
version=10,
currency="g1",
blockstamp=BlockUID(
48000, "0000010D30B1284D34123E036B7BE0A449AE9F2B928A77D7D20E3BDEAC7EE14C"
),
blockstamp=fake_block_uid,
locktime=0,
issuers=["BFb5yv8z1fowR6Z8mBXTALy5z7gHfMU976WtXhmRsUMh"],
inputs=[
......
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