Commit 2c4f2057 authored by Moul's avatar Moul

[test] Block document: Upgrade blocks to v11 and TX to v10

parent 1502362a
......@@ -8,14 +8,18 @@ import unittest
from duniterpy.documents.block import Block
from duniterpy.documents.block_uid import BlockUID, block_uid
raw_block = """Version: 2
raw_block = """Version: 11
Type: Block
Currency: zeta_brouzouf
Number: 15
PoWMin: 4
Time: 1418083330
MedianTime: 1418080208
UnitBase: 0
Issuer: HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk
IssuersFrame: 1
IssuersFrameVar: 0
DifferentIssuersCount: 0
PreviousHash: 0000E73C340601ACA1AD5AAA5B5E56B03E178EF8
PreviousIssuer: HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk
MembersCount: 4
......@@ -32,7 +36,7 @@ Nonce: 45079
42yQm4hGTJYWkPg39hQAUgP6S6EQ4vTfXdJuxKEHL1ih6YHiDL2hcwrFgBHjXLRgxRhj2VNVqqc6b4JayKqTE14r
"""
raw_block_with_tx = """Version: 10
raw_block_with_tx = """Version: 11
Type: Block
Currency: meta_brouzouf
Number: 34436
......@@ -98,7 +102,7 @@ Nonce: 581
nY/MsFU2luiohLmSiOOimL1RIqbriOBgc22ua03Z2dhxtSJxKZeGNGDvl1jaXgmEBRnXU87yXbZ7ioOS/AAVCA==
"""
raw_block_zero = """Version: 10
raw_block_zero = """Version: 11
Type: Block
Currency: zeta_brouzouf
Number: 0
......@@ -145,14 +149,18 @@ Nonce: 2125
42yQm4hGTJYWkPg39hQAUgP6S6EQ4vTfXdJuxKEHL1ih6YHiDL2hcwrFgBHjXLRgxRhj2VNVqqc6b4JayKqTE14r
"""
raw_block_with_leavers = """Version: 2
raw_block_with_leavers = """Version: 11
Type: Block
Currency: meta_brouzouf
Number: 34895
PoWMin: 4
Time: 1444434128
MedianTime: 1444426438
UnitBase: 0
Issuer: HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk
IssuersFrame: 1
IssuersFrameVar: 0
DifferentIssuersCount: 0
PreviousHash: 0000E88115ADDF79344372C0212928501E21622B
PreviousIssuer: HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk
MembersCount: 21
......@@ -170,7 +178,7 @@ Nonce: 9906
5LZCFSnm5FkFihPBTpmsPyILEdvu8MXfJOp6OR4d1s+/e2jVWg4J6YSDfO2KBBPgubASyr2QwQuiBlYD2918Bw==
"""
raw_block_with_excluded = """Version: 3
raw_block_with_excluded = """Version: 11
Type: Block
Currency: test_net
Number: 33365
......@@ -195,7 +203,7 @@ Excluded:
2VAxjr8QoJtSzhE7APno4AkR2RAQNySpNNvDzMgPotSF
Certifications:
Transactions:
TX:3:1:4:4:12:1:0
TX:10:1:4:4:12:1:0
33363-000021C4B5BE2DA996F953DC09482F4FA2FA68774B1A38FAB03B2AAB4A08EBE0
TENGx7WtzFsTXwnbrPEvb6odX2WnqYcnnrjiiLvp1mS
5:0:T:D25272F1D778B52798B7A51CF0CE21F7C5812F841374508F4367872D4A47F0F7:0
......@@ -225,7 +233,7 @@ Nonce: 137387
GmgYhWrwCtsK7t2B/omPpxZ8EfJgv9UYzJIFo++Za+A0Mo70xRfZG7kywxbQTTxDk/V7r90P946N89vdVjv1Bg==
"""
negative_issuers_frame_var = """Version: 3
negative_issuers_frame_var = """Version: 11
Type: Block
Currency: test_net
Number: 34662
......@@ -248,7 +256,7 @@ Revoked:
Excluded:
Certifications:
Transactions:
TX:3:1:4:4:2:1:0
TX:10:1:4:4:2:1:0
34660-00001EEB3FDCEB2F9F39F931ED8F6D419C4C64B4D3F7EA52C35FB6B07A085664
5ocqzyDMMWf1V8bsoNhWb1iNwax1e9M7VTUN6navs8of
765201:3:T:636150D38D565DA0B9717E93C2AD8D6270FA032BF963360ECFCDD55F44493F08:1
......@@ -272,7 +280,7 @@ WnJvw204wccmSBQK9UE2rCFw0EG34zf+b58n2KTLwSIhTpgmGsnr5ohkSyYZYcLEKjisLXKNCmMl7D1Q
class TestBlock(unittest.TestCase):
def test_fromraw(self):
block = Block.from_signed_raw(raw_block)
self.assertEqual(block.version, 2)
self.assertEqual(block.version, 11)
self.assertEqual(block.currency, "zeta_brouzouf")
self.assertEqual(block.noonce, 45079)
self.assertEqual(block.number, 15)
......@@ -293,7 +301,7 @@ class TestBlock(unittest.TestCase):
def test_from_signed_raw_block_zero(self):
block = Block.from_signed_raw(raw_block_zero)
self.assertEqual(block.version, 10)
self.assertEqual(block.version, 11)
self.assertEqual(block.currency, "zeta_brouzouf")
self.assertEqual(block.noonce, 2125)
self.assertEqual(block.number, 0)
......@@ -321,7 +329,7 @@ class TestBlock(unittest.TestCase):
rendered_raw = block.signed_raw()
from_rendered_raw = Block.from_signed_raw(rendered_raw)
self.assertEqual(from_rendered_raw.version, 2)
self.assertEqual(from_rendered_raw.version, 11)
self.assertEqual(from_rendered_raw.currency, "zeta_brouzouf")
self.assertEqual(from_rendered_raw.noonce, 45079)
self.assertEqual(from_rendered_raw.number, 15)
......@@ -347,7 +355,7 @@ class TestBlock(unittest.TestCase):
rendered_raw = block.signed_raw()
from_rendered_raw = block.from_signed_raw(rendered_raw)
self.assertEqual(from_rendered_raw.version, 10)
self.assertEqual(from_rendered_raw.version, 11)
self.assertEqual(from_rendered_raw.currency, "zeta_brouzouf")
self.assertEqual(from_rendered_raw.noonce, 2125)
self.assertEqual(from_rendered_raw.number, 0)
......@@ -371,7 +379,7 @@ class TestBlock(unittest.TestCase):
rendered_raw = block.signed_raw()
from_rendered_raw = block.from_signed_raw(rendered_raw)
self.assertEqual(from_rendered_raw.version, 10)
self.assertEqual(from_rendered_raw.version, 11)
self.assertEqual(from_rendered_raw.currency, "meta_brouzouf")
self.assertEqual(from_rendered_raw.noonce, 581)
self.assertEqual(from_rendered_raw.number, 34436)
......@@ -395,7 +403,7 @@ class TestBlock(unittest.TestCase):
block = Block.from_signed_raw(raw_block_with_leavers)
rendered_raw = block.signed_raw()
from_rendered_raw = block.from_signed_raw(rendered_raw)
self.assertEqual(from_rendered_raw.version, 2)
self.assertEqual(from_rendered_raw.version, 11)
self.assertEqual(from_rendered_raw.currency, "meta_brouzouf")
self.assertEqual(from_rendered_raw.noonce, 9906)
self.assertEqual(from_rendered_raw.number, 34895)
......@@ -458,7 +466,7 @@ class TestBlock(unittest.TestCase):
self.fail("Empty blockuid __nonzero__ comparison failed")
def test_proof_of_work(self):
block = """Version: 5
block = """Version: 11
Type: Block
Currency: test_net
Number: 60803
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment