Rehabilitate tests, rename camelcase sign methods to snake case

This commit is contained in:
nolash
2021-03-26 13:08:36 +01:00
parent 80cc54e3ba
commit c669ed829f
9 changed files with 26 additions and 28 deletions

View File

@@ -41,7 +41,7 @@ class MockEthTxBackend:
def builder_two(self, tx):
tx['value'] = 10243
tx['to'] = to_checksum_address('0x' + os.urandom(20).hex())
tx['data'] = ''
tx['data'] = '0x'
if tx.get('feePrice') != None:
tx['gasPrice'] = tx['feePrice']
del tx['feePrice']

View File

@@ -48,7 +48,7 @@ class TestDict(unittest.TestCase):
def test_sign_message(self):
s = ReferenceSigner(self.db)
z = s.signEthereumMessage(self.address_hex[2:], b'foo')
z = s.sign_ethereum_message(self.address_hex[2:], b'foo')
logg.debug('zzz {}'.format(str(z)))

View File

@@ -12,7 +12,7 @@ from psycopg2 import sql
from cryptography.fernet import Fernet, InvalidToken
# local imports
from crypto_dev_signer.keystore.postgres import ReferenceKeystore
from crypto_dev_signer.keystore.reference import ReferenceKeystore
from crypto_dev_signer.error import UnknownAccountError
logging.basicConfig(level=logging.DEBUG)

View File

@@ -68,14 +68,14 @@ class TestSign(unittest.TestCase):
t = EIP155Transaction(tx_ints, 0)
self.assertRegex(t.__class__.__name__, "Transaction")
s = t.serialize()
self.assertEqual('{}'.format(s), "{'nonce': '0x00', 'gasPrice': '0x04a817c800', 'gas': '0x5208', 'to': '0x3535353535353535353535353535353535353535', 'value': '0x03e8', 'data': '0xdeadbeef', 'v': '0x01', 'r': '', 's': ''}")
self.assertEqual('{}'.format(s), "{'nonce': '0x', 'gasPrice': '0x04a817c800', 'gas': '0x5208', 'to': '0x3535353535353535353535353535353535353535', 'value': '0x03e8', 'data': '0xdeadbeef', 'v': '0x01', 'r': '0x', 's': '0x'}")
r = t.rlp_serialize()
self.assertEqual(r.hex(), 'ea808504a817c8008252089435353535353535353535353535353535353535358203e884deadbeef018080')
t = EIP155Transaction(tx_hexs, 0)
self.assertRegex(t.__class__.__name__, "Transaction")
s = t.serialize()
self.assertEqual('{}'.format(s), "{'nonce': '0x00', 'gasPrice': '0x04a817c800', 'gas': '0x5208', 'to': '0x3535353535353535353535353535353535353535', 'value': '0x03e8', 'data': '0xdeadbeef', 'v': '0x01', 'r': '', 's': ''}")
self.assertEqual('{}'.format(s), "{'nonce': '0x', 'gasPrice': '0x04a817c800', 'gas': '0x5208', 'to': '0x3535353535353535353535353535353535353535', 'value': '0x03e8', 'data': '0xdeadbeef', 'v': '0x01', 'r': '0x', 's': '0x'}")
r = t.rlp_serialize()
self.assertEqual(r.hex(), 'ea808504a817c8008252089435353535353535353535353535353535353535358203e884deadbeef018080')
@@ -84,13 +84,13 @@ class TestSign(unittest.TestCase):
def test_sign_transaction(self):
t = EIP155Transaction(tx_ints, 461, 8995)
s = ReferenceSigner(self.pk_getter)
z = s.signTransaction(t)
z = s.sign_transaction(t)
def test_sign_message(self):
s = ReferenceSigner(self.pk_getter)
z = s.signEthereumMessage(tx_ints['from'], '666f6f')
z = s.signEthereumMessage(tx_ints['from'], b'foo')
z = s.sign_ethereum_message(tx_ints['from'], '666f6f')
z = s.sign_ethereum_message(tx_ints['from'], b'foo')
logg.debug('zzz {}'.format(str(z)))