Skip to content

Commit 8e6380d

Browse files
committed
Added testnets on module tests
1 parent 61abdba commit 8e6380d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/test_modules.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from etherscan.etherscan import Etherscan
88

9-
CONFIG_PATH = "etherscan/configs/stable.json"
9+
CONFIG_PATH = "etherscan/configs/{}-stable.json"
1010
API_KEY = os.environ["API_KEY"] # Encrypted env var by Travis
1111

1212

@@ -22,18 +22,20 @@ def dump(data, fname):
2222

2323
class Case(TestCase):
2424
_MODULE = ""
25+
_NETS = ["MAIN", "GOERLI", "KOVAN", "RINKEBY", "ROPSTEN"]
2526

26-
def test_methods(self):
27-
print(f"\nMODULE: {self._MODULE}")
28-
config = load(CONFIG_PATH)
29-
etherscan = Etherscan(API_KEY)
27+
def methods(self, net):
28+
print(f"\nNET: {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

4753
class TestAccounts(Case):
4854
_MODULE = "accounts"

0 commit comments

Comments
 (0)