From 317b0453844b9c5dc6c1532b119e97d5a806f197 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sun, 4 Aug 2024 23:53:13 +0700 Subject: [PATCH] Create test_blockchain.py --- .../daictd/tests/test_blockchain.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 blockchain_integration/pi_network/daictd/tests/test_blockchain.py diff --git a/blockchain_integration/pi_network/daictd/tests/test_blockchain.py b/blockchain_integration/pi_network/daictd/tests/test_blockchain.py new file mode 100644 index 000000000..43a747b3e --- /dev/null +++ b/blockchain_integration/pi_network/daictd/tests/test_blockchain.py @@ -0,0 +1,19 @@ +import unittest +from blockchain import Blockchain + +class TestBlockchain(unittest.TestCase): + def setUp(self): + self.blockchain = Blockchain() + + def test_add_block(self): + # Test adding a new block to the blockchain + block_data = [...] + self.blockchain.add_block(block_data) + self.assertEqual(len(self.blockchain.chain), 1) + + def test_verify_chain(self): + # Test verifying the integrity of the blockchain + self.assertTrue(self.blockchain.verify_chain()) + +if __name__ == '__main__': + unittest.main()