Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Nov 2, 2023
1 parent 25c3fee commit 561361d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions integration_tests/test_ica_precompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ def check_status():
wait_for_fn("current status", check_status)


def assert_packet_event(logs, seq, status):
def assert_packet_result(event, seq, status):
(logs) = event.getLogs()
assert len(logs) > 0
return logs[0].args == AttributeDict({"seq": seq, "status": status})


Expand Down Expand Up @@ -252,11 +254,9 @@ def submit_msgs_ro(func, str):
last_seq = tcontract.caller.getLastSeq()
wait_for_status_change(tcontract, last_seq)
status = tcontract.caller.statusMap(last_seq)
status = tcontract.caller.statusMap(last_seq)
assert expected_seq == last_seq
assert status == Status.SUCCESS
(logs) = tcontract.events.OnPacketResult.getLogs()
assert_packet_event(logs, expected_seq, status)
assert_packet_result(tcontract.events.OnPacketResult, last_seq, status)
balance -= diff
assert cli_host.balance(ica_address, denom=denom) == balance

Expand All @@ -276,8 +276,7 @@ def submit_msgs_ro(func, str):
status = tcontract.caller.statusMap(last_seq)
assert expected_seq == last_seq
assert status == Status.SUCCESS
(logs) = tcontract.events.OnPacketResult.getLogs()
assert_packet_event(logs, expected_seq, status)
assert_packet_result(tcontract.events.OnPacketResult, last_seq, status)
balance -= diff
assert cli_host.balance(ica_address, denom=denom) == balance

Expand All @@ -298,8 +297,7 @@ def submit_msgs_ro(func, str):
status = tcontract.caller.statusMap(last_seq)
assert expected_seq == last_seq
assert status == Status.FAIL
(logs) = tcontract.events.OnPacketResult.getLogs()
assert_packet_event(logs, expected_seq, status)
assert_packet_result(tcontract.events.OnPacketResult, last_seq, status)
assert cli_host.balance(ica_address, denom=denom) == balance

# balance should not change on timeout
Expand All @@ -319,6 +317,5 @@ def submit_msgs_ro(func, str):
status = tcontract.caller.statusMap(last_seq)
assert expected_seq == last_seq
assert status == Status.FAIL
(logs) = tcontract.events.OnPacketResult.getLogs()
assert_packet_event(logs, expected_seq, status)
assert_packet_result(tcontract.events.OnPacketResult, last_seq, status)
assert cli_host.balance(ica_address, denom=denom) == balance

0 comments on commit 561361d

Please sign in to comment.