test_sqlthread codestyle refactoring

This commit is contained in:
shportix 2023-09-15 13:39:29 +03:00
parent 5803410574
commit ef0fd969ab
No known key found for this signature in database
GPG Key ID: 2594F3870220CC1E

View File

@ -36,6 +36,7 @@ class TestSqlBase(object): # pylint: disable=E1101, too-few-public-methods, E10
self.test_db.initialize_schema()
def get_table_schema(self, table_name):
"""Get table list of column names and value types by table name"""
self.test_db.cur.execute("""PRAGMA table_info({})""".format(table_name))
res = self.test_db.cur.fetchall()
res = [[x[1], x[2]] for x in res]
@ -98,7 +99,7 @@ class TestInitializerBitmessageDB(TestSqlBase, unittest.TestCase):
['encodingtype', 'int'],
['read', 'bool'],
['sighash', 'blob']]
self.assertEqual(res,check,"inbox table not valid")
self.assertEqual(res, check, "inbox table not valid")
def test_sent_table_init(self):
"""
@ -216,6 +217,7 @@ class TestUpgradeBitmessageDB(TestSqlBase, unittest.TestCase): # pylint: disabl
self._setup_db()
self.test_db.cur.execute('''INSERT INTO settings VALUES('version','2')''')
def version(self):
"""
Run SQL Scripts, Initialize DB with respect to versioning