Skip to content

Commit

Permalink
fix checks for instructions (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-neon authored Aug 9, 2024
1 parent 52f6356 commit 16974fc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions integration/tests/basic/indexer/test_instruction_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_tx_exec_from_data(self, json_rpc_client):
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"TxExecFromData": 1})
assert "TxExecFromData" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_tx_step_from_data(self, counter_contract, json_rpc_client):
Expand All @@ -47,9 +47,8 @@ def test_tx_step_from_data(self, counter_contract, json_rpc_client):

response = json_rpc_client.get_neon_trx_receipt(resp["transactionHash"])
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"TxStepFromData": 12})
assert "TxStepFromData" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_cancel_with_hash(self, json_rpc_client, expected_error_checker):
Expand All @@ -62,7 +61,7 @@ def test_cancel_with_hash(self, json_rpc_client, expected_error_checker):
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"TxStepFromData": 11, "CancelWithHash": 1})
assert "CancelWithHash" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_tx_exec_from_data_solana_call(self, call_solana_caller, counter_resource_address, json_rpc_client):
Expand All @@ -88,11 +87,12 @@ def test_tx_exec_from_data_solana_call(self, call_solana_caller, counter_resourc
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"TxExecFromDataSolanaCall": 1})
assert "TxExecFromDataSolanaCall" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_tx_step_from_account_no_chain_id(self, counter_contract, json_rpc_client):
def test_tx_step_from_account_no_chain_id(self, counter_contract, json_rpc_client, faucet):
sender_account = self.accounts[0]
faucet.request_neon(sender_account.address, 1000)
tx = self.web3_client.make_raw_tx(sender_account, estimate_gas=True)
tx["chainId"] = None

Expand All @@ -103,7 +103,7 @@ def test_tx_step_from_account_no_chain_id(self, counter_contract, json_rpc_clien
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"TxStepFromAccountNoChainId": 3, "HolderWrite": 1})
assert "TxStepFromAccountNoChainId" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_holder_write_tx_exec_from_account(self, multiple_actions_erc721, json_rpc_client):
Expand All @@ -127,7 +127,8 @@ def test_holder_write_tx_exec_from_account(self, multiple_actions_erc721, json_r
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"HolderWrite": 1, "TxExecFromAccount": 1})
assert "HolderWrite" in count_instructions(validated_response).keys()
assert "TxExecFromAccount" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_step_from_account(self, multiple_actions_erc721, json_rpc_client):
Expand All @@ -148,7 +149,7 @@ def test_step_from_account(self, multiple_actions_erc721, json_rpc_client):
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"TxStepFromAccount": 9, "HolderWrite": 1})
assert "TxStepFromAccount" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

def test_tx_exec_from_account_solana_call(
Expand Down Expand Up @@ -176,5 +177,5 @@ def test_tx_exec_from_account_solana_call(
validated_response = NeonGetTransactionResult(**response)

assert_instructions(validated_response)
assert count_instructions(validated_response) == Counter({"HolderWrite": 3, "TxExecFromAccountSolanaCall": 1})
assert "TxExecFromAccountSolanaCall" in count_instructions(validated_response).keys()
assert_solana_trxs_in_neon_receipt(json_rpc_client, resp["transactionHash"], validated_response)

0 comments on commit 16974fc

Please sign in to comment.