66
77from etherscan .etherscan import Etherscan
88
9- CONFIG_PATH = "etherscan/configs/stable.json"
9+ CONFIG_PATH = "etherscan/configs/{}- stable.json"
1010API_KEY = os .environ ["API_KEY" ] # Encrypted env var by Travis
1111
1212
@@ -22,18 +22,20 @@ def dump(data, fname):
2222
2323class Case (TestCase ):
2424 _MODULE = ""
25+ _NETS = ["MAIN" , "GOERLI" , "KOVAN" , "RINKEBY" , "ROPSTEN" ]
2526
26- def test_methods (self ):
27- print (f"\n MODULE: { self ._MODULE } " )
28- config = load (CONFIG_PATH )
29- etherscan = Etherscan (API_KEY )
27+ def methods (self , net ):
28+ print (f"\n NET: { net } " )
29+ print (f"MODULE: { self ._MODULE } " )
30+ config = load (CONFIG_PATH .format (net ))
31+ etherscan = Etherscan (API_KEY , net )
3032 for fun , v in config .items ():
3133 if not fun .startswith ("_" ): # disabled if _
3234 if v ["module" ] == self ._MODULE :
3335 res = getattr (etherscan , fun )(** v ["kwargs" ])
3436 print (f"METHOD: { fun } , RTYPE: { type (res )} " )
3537 # Create log files (will update existing ones)
36- fname = f"logs/standard/{ fun } .json"
38+ fname = f"logs/standard/{ net } - { fun } .json"
3739 log = {
3840 "method" : fun ,
3941 "module" : v ["module" ],
@@ -43,6 +45,10 @@ def test_methods(self):
4345 }
4446 dump (log , fname )
4547
48+ def test_net_methods (self ):
49+ for net in self ._NETS :
50+ self .methods (net )
51+
4652
4753class TestAccounts (Case ):
4854 _MODULE = "accounts"
0 commit comments