Add tests for chainspec change

This commit is contained in:
nolash 2021-10-18 13:23:20 +02:00
parent 56813e3021
commit f0e5028d1b
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -7,6 +7,13 @@ from tests.base import TestBase
class TestChain(TestBase):
def test_chain_spec_str(self):
s = ChainSpec('foo', 'bar', 3, 'baz')
self.assertEqual('foo:bar:3:baz', str(s))
s = ChainSpec('foo', 'bar', 3)
self.assertEqual('foo:bar:3', str(s))
def test_chain_spec(self):
s = ChainSpec.from_chain_str('foo:bar:3')
@ -18,5 +25,18 @@ class TestChain(TestBase):
s = ChainSpec.from_chain_str('foo')
def test_chain_spec_dict(self):
s = 'foo:bar:3:baz'
c = ChainSpec.from_chain_str('foo:bar:3:baz')
d = c.asdict()
self.assertEqual(d['arch'], 'foo')
self.assertEqual(d['fork'], 'bar')
self.assertEqual(d['network_id'], 3)
self.assertEqual(d['common_name'], 'baz')
cc = ChainSpec.from_dict(d)
self.assertEqual(s, str(cc))
if __name__ == '__main__':
unittest.main()