Rehabilitate tests
This commit is contained in:
parent
700c52089e
commit
5cfb6a7dda
@ -3,5 +3,5 @@ pysha3==1.0.2
|
|||||||
hexathon~=0.0.1a8
|
hexathon~=0.0.1a8
|
||||||
websocket-client==0.57.0
|
websocket-client==0.57.0
|
||||||
potaahto~=0.0.1a1
|
potaahto~=0.0.1a1
|
||||||
chainlib==0.0.9rc1
|
chainlib==0.0.10a2
|
||||||
confini>=0.4.1a1,<0.5.0
|
confini>=0.4.1a1,<0.5.0
|
||||||
|
@ -12,7 +12,7 @@ from tests.base import TestBase
|
|||||||
class TestChain(TestBase):
|
class TestChain(TestBase):
|
||||||
|
|
||||||
def test_chain_spec(self):
|
def test_chain_spec(self):
|
||||||
checksum_address = '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C'
|
checksum_address = 'Eb3907eCad74a0013c259D5874AE7f22DcBcC95C'
|
||||||
plain_address = checksum_address.lower()
|
plain_address = checksum_address.lower()
|
||||||
|
|
||||||
self.assertEqual(checksum_address, to_checksum(checksum_address))
|
self.assertEqual(checksum_address, to_checksum(checksum_address))
|
||||||
|
@ -16,7 +16,10 @@ import chainlib
|
|||||||
from chainlib.eth.connection import EthUnixSignerConnection
|
from chainlib.eth.connection import EthUnixSignerConnection
|
||||||
from chainlib.eth.sign import sign_transaction
|
from chainlib.eth.sign import sign_transaction
|
||||||
from chainlib.eth.tx import TxFactory
|
from chainlib.eth.tx import TxFactory
|
||||||
from chainlib.eth.address import to_checksum_address
|
from chainlib.eth.address import (
|
||||||
|
to_checksum_address,
|
||||||
|
is_same_address,
|
||||||
|
)
|
||||||
from chainlib.jsonrpc import (
|
from chainlib.jsonrpc import (
|
||||||
jsonrpc_response,
|
jsonrpc_response,
|
||||||
jsonrpc_error,
|
jsonrpc_error,
|
||||||
@ -52,11 +55,13 @@ class Mocket(socket.socket):
|
|||||||
logg.debug('mocket received {}'.format(v))
|
logg.debug('mocket received {}'.format(v))
|
||||||
Mocket.req_id = o['id']
|
Mocket.req_id = o['id']
|
||||||
params = o['params'][0]
|
params = o['params'][0]
|
||||||
if to_checksum_address(params.get('from')) != alice:
|
from_address = to_checksum_address(params.get('from'))
|
||||||
logg.error('from does not match alice {}'.format(params))
|
if not is_same_address(alice, from_address):
|
||||||
|
logg.error('from {} does not match alice {}'.format(from_address, alice)) #params))
|
||||||
Mocket.error = True
|
Mocket.error = True
|
||||||
if to_checksum_address(params.get('to')) != bob:
|
to_address = to_checksum_address(params.get('to'))
|
||||||
logg.error('to does not match bob {}'.format(params))
|
if not is_same_address(bob, to_address):
|
||||||
|
logg.error('to {} does not match bob {}'.format(to_address, bob)) #params))
|
||||||
Mocket.error = True
|
Mocket.error = True
|
||||||
if not Mocket.error:
|
if not Mocket.error:
|
||||||
Mocket.tx = EIP155Transaction(params, params['nonce'], params['chainId'])
|
Mocket.tx = EIP155Transaction(params, params['nonce'], params['chainId'])
|
||||||
|
@ -23,7 +23,10 @@ from chainlib.eth.contract import (
|
|||||||
ABIContractEncoder,
|
ABIContractEncoder,
|
||||||
ABIContractType,
|
ABIContractType,
|
||||||
)
|
)
|
||||||
from chainlib.eth.address import to_checksum_address
|
from chainlib.eth.address import (
|
||||||
|
to_checksum_address,
|
||||||
|
is_same_address,
|
||||||
|
)
|
||||||
from hexathon import (
|
from hexathon import (
|
||||||
strip_0x,
|
strip_0x,
|
||||||
add_0x,
|
add_0x,
|
||||||
@ -43,8 +46,8 @@ class TxTestCase(EthTesterCase):
|
|||||||
c = Gas(signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle, chain_spec=self.chain_spec)
|
c = Gas(signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle, chain_spec=self.chain_spec)
|
||||||
(tx_hash_hex, o) = c.create(self.accounts[0], self.accounts[1], 1024, tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, o) = c.create(self.accounts[0], self.accounts[1], 1024, tx_format=TxFormat.RLP_SIGNED)
|
||||||
tx = unpack(bytes.fromhex(strip_0x(o)), self.chain_spec)
|
tx = unpack(bytes.fromhex(strip_0x(o)), self.chain_spec)
|
||||||
self.assertEqual(tx['from'], self.accounts[0])
|
self.assertTrue(is_same_address(tx['from'], self.accounts[0]))
|
||||||
self.assertEqual(tx['to'], self.accounts[1])
|
self.assertTrue(is_same_address(tx['to'], self.accounts[1]))
|
||||||
|
|
||||||
|
|
||||||
def test_tx_pack(self):
|
def test_tx_pack(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user