forked from bitshares/python-bitshares
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_blockchain.py
More file actions
71 lines (60 loc) · 1.85 KB
/
test_blockchain.py
File metadata and controls
71 lines (60 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import unittest
from pprint import pprint
from bitshares import BitShares
from bitshares.blockchain import Blockchain
from bitshares.block import Block
from bitshares.instance import set_shared_bitshares_instance
from bitshares.utils import parse_time
from .fixtures import fixture_data
class Testcases(unittest.TestCase):
def setUp(self):
fixture_data()
self.chain = Blockchain(mode="head")
def test_is_irv(self):
self.assertFalse(self.chain.is_irreversible_mode())
def test_info(self):
info = self.chain.info()
for i in [
"time",
"dynamic_flags",
"head_block_id",
"head_block_number",
"last_budget_time"
]:
self.assertIn(i, info)
def test_parameters(self):
info = self.chain.chainParameters()
for i in [
"worker_budget_per_day",
"maintenance_interval",
]:
self.assertIn(i, info)
def test_network(self):
info = self.chain.get_network()
for i in [
"chain_id",
"core_symbol",
"prefix",
]:
self.assertIn(i, info)
def test_props(self):
info = self.chain.get_chain_properties()
for i in [
"id",
"chain_id",
"immutable_parameters",
]:
self.assertIn(i, info)
def test_block_num(self):
num = self.chain.get_current_block_num()
self.assertTrue(num > 100)
def test_block(self):
block = self.chain.get_current_block()
self.assertIsInstance(block, Block)
self.chain.block_time(1)
self.chain.block_timestamp(1)
def test_list_accounts(self):
for account in self.chain.get_all_accounts():
self.assertIsInstance(account, str)
# Break already
break