-
-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathtest_accounts.py
executable file
·32 lines (25 loc) · 1001 Bytes
/
test_accounts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import unittest
import warnings
from etherscan.accounts import Account
SINGLE_BALANCE = '40891626854930000000000'
SINGLE_ACCOUNT = '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a'
MULTI_ACCOUNT = [
'0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a',
'0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a',
]
MULTI_BALANCE = [
{'account': '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a',
'balance': '40891626854930000000000'},
{'account': '0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a',
'balance': '40891626854930000000000'}
]
API_KEY = 'YourAPIkey'
class AccountsTestCase(unittest.TestCase):
def setUp(self):
warnings.simplefilter('ignore', ResourceWarning)
def test_get_balance(self):
api = Account(address=SINGLE_ACCOUNT, api_key=API_KEY)
self.assertEqual(api.get_balance(), SINGLE_BALANCE)
def test_get_balance_multi(self):
api = Account(address=MULTI_ACCOUNT, api_key=API_KEY)
self.assertEqual(api.get_balance_multiple(), MULTI_BALANCE)