def test_get_genesis_block_whenCalled_thenCreatesAndReturnsBlockWithGenesisTransactions(self):
genesis_transaction_one = Transaction(
"0",
"03dd1e57d05d9cab1d8d9b727568ad951ac2d9ecd082bc36f69e021b8427812924",
500000,
0
)
genesis_transaction_two = Transaction(
"0",
"03dd1e3defd36c8c0c7282ca1a324851efdb15f742cac0c5b258ef7b290ece9e5d",
500000,
0
)
genesis_transactions = [genesis_transaction_one, genesis_transaction_two]
with patch.object(Blockchain, '__init__', return_value=None) as patched_init, \
patch('crankycoin.blockchain.Block') as patched_Block:
patched_Block._calculate_block_hash.return_value = "mock_block_hash"
subject = Blockchain()
genesis_block = subject.get_genesis_block()
patched_Block.assert_called_once_with(0, genesis_transactions, 0, 0, 0)
评论列表
文章目录