Skip to content

Commit a6e7470

Browse files
committed
chore: updated examples and tests
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
1 parent e877725 commit a6e7470

File tree

6 files changed

+256
-121
lines changed

6 files changed

+256
-121
lines changed

examples/consensus/topic_message.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,21 @@ def __init__(self, seconds: int, nanos: int = 0):
2020
self.seconds = seconds
2121
self.nanos = nanos
2222

23+
class MockAccountID:
24+
"""Mocks the protobuf AccountID object."""
25+
def __init__(self, shard, realm, num):
26+
self.shardNum = shard
27+
self.realmNum = realm
28+
self.accountNum = num
29+
self.alias = None
30+
2331
class MockTransactionID:
2432
"""Mocks the protobuf TransactionID object."""
2533
def __init__(self, account_id, seconds, nanos):
2634

27-
self.shardNum = account_id.shard
28-
self.realmNum = account_id.realm
29-
self.accountNum = account_id.num
35+
self.accountID = account_id
3036
self.transactionValidStart = MockTimestamp(seconds, nanos)
37+
self.scheduled = False
3138

3239
class MockChunkInfo:
3340
"""Mocks the protobuf ChunkInfo object."""
@@ -72,13 +79,7 @@ def mock_consensus_response(
7279

7380
chunk_info = None
7481
if is_chunked:
75-
76-
class MockAcct:
77-
shard = 0
78-
realm = 0
79-
num = 10
80-
81-
tx_id = MockTransactionID(MockAcct(), 1736539100, 1) if has_tx_id else None
82+
tx_id = MockTransactionID(MockAccountID(0,0,10), 1736539100, 1) if has_tx_id else None
8283
chunk_info = MockChunkInfo(seq, total_chunks, tx_id)
8384

8485
return MockResponse(message, seq, timestamp, chunk_info)

0 commit comments

Comments
 (0)