Skip to content

Commit

Permalink
Fix CI Tests (#1255)
Browse files Browse the repository at this point in the history
* Fix CowSwap api test

* Add ETHERSCAN_API_KEY condition to tests
  • Loading branch information
falvaradorodriguez authored Aug 2, 2024
1 parent 3cb0b64 commit 75ebb84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions gnosis/cowsap/tests/test_cow_swap_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def test_get_trades(self):
"buyToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"txHash": "0x691d1a8ba39c036e841b6e2ed970f9068ac4a27b61955afb852f11019f2ff4d8",
"feePolicies": [],
}
],
)
Expand Down
15 changes: 13 additions & 2 deletions gnosis/eth/tests/clients/test_etherscan_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from django.test import TestCase

import pytest
Expand All @@ -8,9 +10,18 @@


class TestEtherscanClient(TestCase):
@classmethod
def get_etherscan_api(cls, network: EthereumNetwork):
etherscan_api_key_variable_name = "ETHERSCAN_API_KEY"
etherscan_api_key = os.environ.get(etherscan_api_key_variable_name)
if not etherscan_api_key:
pytest.skip(f"{etherscan_api_key_variable_name} needs to be defined")

return EtherscanClient(network, api_key=etherscan_api_key)

def test_etherscan_get_abi(self):
try:
etherscan_api = EtherscanClient(EthereumNetwork.MAINNET)
etherscan_api = self.get_etherscan_api(EthereumNetwork.MAINNET)
safe_master_copy_abi = sourcify_safe_metadata["output"]["abi"]
safe_master_copy_address = "0x6851D6fDFAfD08c0295C392436245E5bc78B0185"
self.assertEqual(
Expand All @@ -33,7 +44,7 @@ def test_etherscan_get_abi(self):
@pytest.mark.xfail(reason="Test might fail due to third-party service issues")
def test_etherscan_get_abi_zksync(self):
multisend_address = "0x0dFcccB95225ffB03c6FBB2559B530C2B7C8A912"
etherscan_api = EtherscanClient(EthereumNetwork(324))
etherscan_api = self.get_etherscan_api(EthereumNetwork(324))
self.assertEqual(
etherscan_api.get_contract_abi(multisend_address),
etherscan_multisend_abi,
Expand Down

0 comments on commit 75ebb84

Please sign in to comment.