From 561361d8b0f76142b1602cb8ff3e592e86b205be Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 2 Nov 2023 09:20:37 +0800 Subject: [PATCH] cleanup --- integration_tests/test_ica_precompile.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/integration_tests/test_ica_precompile.py b/integration_tests/test_ica_precompile.py index c7ecdc9cb1..e8d8407e41 100644 --- a/integration_tests/test_ica_precompile.py +++ b/integration_tests/test_ica_precompile.py @@ -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}) @@ -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 @@ -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 @@ -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 @@ -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