def blockchain_three_blocks():
    blockchain = Blockchain()
    for i in range(3):
        blockchain.addBlock(i)
    return blockchain
def test_add_block():
    blockchain=Blockchain()
    data='test-data'
    blockchain.addBlock(data)

    assert blockchain.ledger[-1].data==data
Exemple #3
0
 def test_add_single_block(self):
     blockchain = Blockchain()
     blockchain.addBlock(["aaa"])
     self.assertEqual(len(blockchain.chain), 2)