Add password to test

This commit is contained in:
nolash 2020-08-05 19:51:22 +02:00
parent 36ffad1202
commit a845aecda1
Signed by: lash
GPG Key ID: 93EC1C676274C889
2 changed files with 8 additions and 2 deletions

View File

@ -15,6 +15,11 @@ logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger(__file__)
def to_bytes(x):
return x.encode('utf-8')
class ReferenceDatabase:
@ -52,7 +57,8 @@ class ReferenceDatabase:
h = sha3.keccak_256()
h.update(self.symmetric_key)
if password != None:
h.update(password)
password_bytes = to_bytes(password)
h.update(password_bytes)
g = h.digest()
return Fernet(base64.b64encode(g))

View File

@ -40,7 +40,7 @@ class TestDatabase(unittest.TestCase):
""")
self.db.cur.execute("CREATE UNIQUE INDEX ethereum_address_idx ON ethereum ( wallet_address_hex );")
self.db.conn.commit()
self.db.new(self.address_hex)
self.db.new(self.address_hex, 'foo')
def tearDown(self):