def test_invalid_chain(blockchain_3b): ''' Purpose: Test whether a given blockchain is invalid by corrupting it's genesis block and performing validation. ''' blockchain_3b.chain[0].hash = 'test-bad-hash' with pytest.raises(Exception, match='genesis block must be valid.'): Blockchain.is_valid(blockchain_3b.chain)
def test_valid_chain(blockchain_3b): ''' Purpose: Test whether a given blockchain is valid. ''' Blockchain.is_valid(blockchain_3b.chain)