Skip to content
Snippets Groups Projects
Commit 04a63132 authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

Revert "mock data getters in a loop are now guarded by data check"

This reverts commit 479f6a64.
parent 1d4aadeb
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!361Extended mock follow tests
......@@ -5,12 +5,6 @@ class MockDataProvider():
""" Data provider for test operations """
block_data = {}
@classmethod
def is_data(cls):
if cls.block_data:
return True
return False
@classmethod
def print_data(cls):
print(dumps(cls.block_data, indent=4, sort_keys=True))
......@@ -158,15 +158,14 @@ class SteemClient:
num = int(block['block_id'][:8], base=16)
blocks[num] = block
if MockBlockProvider.is_data():
for block_num in block_nums:
data = MockBlockProvider.get_block_data(block_num, True)
if data is not None:
if block_num in blocks:
blocks[block_num]["transactions"].extend(data["transactions"])
blocks[block_num]["transaction_ids"].extend(data["transaction_ids"])
else:
blocks[block_num] = data
for block_num in block_nums:
data = MockBlockProvider.get_block_data(block_num, True)
if data is not None:
if block_num in blocks:
blocks[block_num]["transactions"].extend(data["transactions"])
blocks[block_num]["transaction_ids"].extend(data["transaction_ids"])
else:
blocks[block_num] = data
return [blocks[x] for x in block_nums]
......@@ -184,20 +183,19 @@ class SteemClient:
def enum_virtual_ops(self, conf, begin_block, end_block):
""" Get virtual ops for range of blocks """
def add_mock_vops(ret, from_block, end_block):
if MockVopsProvider.is_data():
for block_num in range(from_block, end_block):
mock_vops = MockVopsProvider.get_block_data(block_num)
if mock_vops:
if block_num in ret:
if 'ops_by_block' in mock_vops:
ret[block_num]['ops'].extend([op['op'] for op in mock_vops['ops_by_block'] if op['block'] == block_num])
if 'ops' in mock_vops:
ret[block_num]['ops'].extend([op['op'] for op in mock_vops['ops'] if op['block'] == block_num])
else:
if 'ops_by_block' in mock_vops:
ret[block_num] = {'timestamp':mock_vops['timestamp'], "ops" : [op['op'] for op in mock_vops['ops_by_block'] if op['block'] == block_num]}
if 'ops' in mock_vops:
ret[block_num] = {'timestamp':mock_vops['timestamp'], "ops" : [op['op'] for op in mock_vops['ops'] if op['block'] == block_num]}
for block_num in range(from_block, end_block):
mock_vops = MockVopsProvider.get_block_data(block_num)
if mock_vops:
if block_num in ret:
if 'ops_by_block' in mock_vops:
ret[block_num]['ops'].extend([op['op'] for op in mock_vops['ops_by_block'] if op['block'] == block_num])
if 'ops' in mock_vops:
ret[block_num]['ops'].extend([op['op'] for op in mock_vops['ops'] if op['block'] == block_num])
else:
if 'ops_by_block' in mock_vops:
ret[block_num] = {'timestamp':mock_vops['timestamp'], "ops" : [op['op'] for op in mock_vops['ops_by_block'] if op['block'] == block_num]}
if 'ops' in mock_vops:
ret[block_num] = {'timestamp':mock_vops['timestamp'], "ops" : [op['op'] for op in mock_vops['ops'] if op['block'] == block_num]}
ret = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment