Return address from import key in same format as get
This commit is contained in:
@@ -6,6 +6,12 @@ import logging
|
||||
import base64
|
||||
import os
|
||||
|
||||
# external imports
|
||||
from hexathon import (
|
||||
strip_0x,
|
||||
add_0x,
|
||||
)
|
||||
|
||||
# local imports
|
||||
from crypto_dev_signer.keystore.dict import DictKeystore
|
||||
from crypto_dev_signer.error import UnknownAccountError
|
||||
@@ -28,7 +34,8 @@ class TestDict(unittest.TestCase):
|
||||
|
||||
keystore_filepath = os.path.join(script_dir, 'testdata', 'UTC--2021-01-08T18-37-01.187235289Z--00a329c0648769a73afac7f9381e08fb43dbea72')
|
||||
|
||||
self.address_hex = self.db.import_keystore_file(keystore_filepath, '')
|
||||
address_hex = self.db.import_keystore_file(keystore_filepath, '')
|
||||
self.address_hex = add_0x(address_hex)
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
@@ -36,8 +43,8 @@ class TestDict(unittest.TestCase):
|
||||
|
||||
|
||||
def test_get_key(self):
|
||||
logg.debug('getting {}'.format(self.address_hex[2:]))
|
||||
pk = self.db.get(self.address_hex[2:], '')
|
||||
logg.debug('getting {}'.format(strip_0x(self.address_hex)))
|
||||
pk = self.db.get(strip_0x(self.address_hex), '')
|
||||
|
||||
self.assertEqual(self.address_hex.lower(), '0x00a329c0648769a73afac7f9381e08fb43dbea72')
|
||||
|
||||
@@ -48,7 +55,7 @@ class TestDict(unittest.TestCase):
|
||||
|
||||
def test_sign_message(self):
|
||||
s = ReferenceSigner(self.db)
|
||||
z = s.sign_ethereum_message(self.address_hex[2:], b'foo')
|
||||
z = s.sign_ethereum_message(strip_0x(self.address_hex), b'foo')
|
||||
logg.debug('zzz {}'.format(str(z)))
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import logging
|
||||
import base64
|
||||
import os
|
||||
|
||||
# third-party imports
|
||||
# external imports
|
||||
import psycopg2
|
||||
from psycopg2 import sql
|
||||
from cryptography.fernet import Fernet, InvalidToken
|
||||
@@ -39,6 +39,7 @@ class TestDatabase(unittest.TestCase):
|
||||
}
|
||||
self.db = ReferenceKeystore('postgres+psycopg2://postgres@localhost:5432/signer_test', **kw)
|
||||
self.address_hex = self.db.new('foo')
|
||||
#self.address_hex = add_0x(address_hex)
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
|
||||
Reference in New Issue
Block a user