Use SQLAlchemy

This commit is contained in:
nolash
2020-10-20 08:37:20 +02:00
parent 4eb2617198
commit f507765331
5 changed files with 66 additions and 32 deletions

View File

@@ -35,19 +35,15 @@ class TestDatabase(unittest.TestCase):
kw = {
'symmetric_key': self.symkey,
}
self.db = ReferenceKeystore('signer_test', **kw)
for ss in ReferenceKeystore.schema:
self.db.cur.execute(ss)
self.db.conn.commit()
self.db = ReferenceKeystore('postgres+psycopg2://postgres@localhost:5432/signer_test', **kw)
self.address_hex = self.db.new('foo')
def tearDown(self):
self.db.conn = psycopg2.connect('dbname=signer_test')
self.db.cur = self.db.conn.cursor()
self.db.cur.execute('DROP INDEX ethereum_address_idx;')
self.db.cur.execute('DROP TABLE ethereum;')
self.db.conn.commit()
self.db.db_session.execute('DROP INDEX ethereum_address_idx;')
self.db.db_session.execute('DROP TABLE ethereum;')
self.db.db_session.commit()
def test_get_key(self):