mirror of
git://holbrook.no/eth-accounts-index
synced 2026-04-27 20:11:04 +02:00
Add javascript interface
This commit is contained in:
@@ -5,7 +5,7 @@ import json
|
||||
import web3
|
||||
import eth_tester
|
||||
|
||||
from eth_accounts_index import Registry
|
||||
from eth_accounts_index import AccountRegistry
|
||||
|
||||
testdir = os.path.dirname(__file__)
|
||||
|
||||
@@ -45,18 +45,18 @@ class Test(unittest.TestCase):
|
||||
|
||||
|
||||
def test_basic(self):
|
||||
registry = Registry(self.w3, self.address)
|
||||
registry = AccountRegistry(self.w3, self.address)
|
||||
self.assertEqual(registry.count(), 1); # count starts at 1, first addess is always 0x0
|
||||
|
||||
|
||||
def test_access(self):
|
||||
registry = Registry(self.w3, self.address, self.w3.eth.accounts[1])
|
||||
registry = AccountRegistry(self.w3, self.address, self.w3.eth.accounts[1])
|
||||
registry.add(self.w3.eth.accounts[2])
|
||||
self.eth_tester.mine_block()
|
||||
self.assertEqual(registry.count(), 2)
|
||||
|
||||
# account 0 does not have access
|
||||
registry = Registry(self.w3, self.address, self.w3.eth.accounts[2])
|
||||
registry = AccountRegistry(self.w3, self.address, self.w3.eth.accounts[2])
|
||||
registry.add(self.w3.eth.accounts[2])
|
||||
self.eth_tester.mine_block()
|
||||
self.assertEqual(registry.count(), 2)
|
||||
@@ -75,7 +75,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
|
||||
def test_indices(self):
|
||||
registry = Registry(self.w3, self.address, self.w3.eth.accounts[1])
|
||||
registry = AccountRegistry(self.w3, self.address, self.w3.eth.accounts[1])
|
||||
registry.add(self.w3.eth.accounts[2])
|
||||
|
||||
self.assertTrue(registry.have(self.w3.eth.accounts[2]))
|
||||
@@ -83,7 +83,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
|
||||
def test_list(self):
|
||||
registry = Registry(self.w3, self.address, self.w3.eth.accounts[1])
|
||||
registry = AccountRegistry(self.w3, self.address, self.w3.eth.accounts[1])
|
||||
|
||||
for i in range(2, 10):
|
||||
registry.add(self.w3.eth.accounts[i])
|
||||
|
||||
Reference in New Issue
Block a user