test_sqlthread refactoring TestInitializerBitmessageDB

This commit is contained in:
shportix 2023-09-18 18:18:20 +03:00
parent 6b2b268a03
commit dab4d00a39
No known key found for this signature in database
GPG Key ID: 2594F3870220CC1E

View File

@ -74,10 +74,11 @@ class TestInitializerBitmessageDB(TestSqlBase, unittest.TestCase):
""" """
self._setup_db() self._setup_db()
def test_inbox_table_init(self): def test_initializer(self):
""" """
Test inbox table Test db initialization
""" """
# check inbox table
res = self.get_table_schema("inbox") res = self.get_table_schema("inbox")
check = [['msgid', 'blob'], check = [['msgid', 'blob'],
['toaddress', 'text'], ['toaddress', 'text'],
@ -91,10 +92,7 @@ class TestInitializerBitmessageDB(TestSqlBase, unittest.TestCase):
['sighash', 'blob']] ['sighash', 'blob']]
self.assertEqual(res, check, "inbox table not valid") self.assertEqual(res, check, "inbox table not valid")
def test_sent_table_init(self): # check sent table
"""
Test sent table
"""
res = self.get_table_schema("sent") res = self.get_table_schema("sent")
check = [['msgid', 'blob'], check = [['msgid', 'blob'],
['toaddress', 'text'], ['toaddress', 'text'],
@ -113,49 +111,34 @@ class TestInitializerBitmessageDB(TestSqlBase, unittest.TestCase):
['ttl', 'int']] ['ttl', 'int']]
self.assertEqual(res, check, "sent table not valid") self.assertEqual(res, check, "sent table not valid")
def test_subscriptions_table_init(self): # check subscriptions table
"""
Test subscriptions table
"""
res = self.get_table_schema("subscriptions") res = self.get_table_schema("subscriptions")
check = [['label', 'text'], check = [['label', 'text'],
['address', 'text'], ['address', 'text'],
['enabled', 'bool']] ['enabled', 'bool']]
self.assertEqual(res, check, "subscriptions table not valid") self.assertEqual(res, check, "subscriptions table not valid")
def test_addressbook_table_init(self): # check addressbook table
"""
Test addressbook table
"""
res = self.get_table_schema("addressbook") res = self.get_table_schema("addressbook")
check = [['label', 'text'], check = [['label', 'text'],
['address', 'text']] ['address', 'text']]
self.assertEqual(res, check, "addressbook table not valid") self.assertEqual(res, check, "addressbook table not valid")
def test_blacklist_table_init(self): # check blacklist table
"""
Test blacklist table
"""
res = self.get_table_schema("blacklist") res = self.get_table_schema("blacklist")
check = [['label', 'text'], check = [['label', 'text'],
['address', 'text'], ['address', 'text'],
['enabled', 'bool']] ['enabled', 'bool']]
self.assertEqual(res, check, "blacklist table not valid") self.assertEqual(res, check, "blacklist table not valid")
def test_whitelist_table_init(self): # check whitelist table
"""
Test whitelist table
"""
res = self.get_table_schema("whitelist") res = self.get_table_schema("whitelist")
check = [['label', 'text'], check = [['label', 'text'],
['address', 'text'], ['address', 'text'],
['enabled', 'bool']] ['enabled', 'bool']]
self.assertEqual(res, check, "whitelist table not valid") self.assertEqual(res, check, "whitelist table not valid")
def test_pubkeys_table_init(self): # check pubkeys table
"""
Test pubkeys table
"""
res = self.get_table_schema("pubkeys") res = self.get_table_schema("pubkeys")
check = [['address', 'text'], check = [['address', 'text'],
['addressversion', 'int'], ['addressversion', 'int'],
@ -164,10 +147,7 @@ class TestInitializerBitmessageDB(TestSqlBase, unittest.TestCase):
['usedpersonally', 'text']] ['usedpersonally', 'text']]
self.assertEqual(res, check, "pubkeys table not valid") self.assertEqual(res, check, "pubkeys table not valid")
def test_inventory_table_init(self): # check inventory table
"""
Test inventory table
"""
res = self.get_table_schema("inventory") res = self.get_table_schema("inventory")
check = [['hash', 'blob'], check = [['hash', 'blob'],
['objecttype', 'int'], ['objecttype', 'int'],
@ -177,19 +157,13 @@ class TestInitializerBitmessageDB(TestSqlBase, unittest.TestCase):
['tag', 'blob']] ['tag', 'blob']]
self.assertEqual(res, check, "inventory table not valid") self.assertEqual(res, check, "inventory table not valid")
def test_settings_table_init(self): # check settings table
"""
Test settings table
"""
res = self.get_table_schema("settings") res = self.get_table_schema("settings")
check = [['key', 'blob'], check = [['key', 'blob'],
['value', 'blob']] ['value', 'blob']]
self.assertEqual(res, check, "settings table not valid") self.assertEqual(res, check, "settings table not valid")
def test_objectprocessorqueue_table_init(self): # check objectprocessorqueue table
"""
Test objectprocessorqueue table
"""
res = self.get_table_schema("objectprocessorqueue") res = self.get_table_schema("objectprocessorqueue")
check = [['objecttype', 'int'], check = [['objecttype', 'int'],
['data', 'blob']] ['data', 'blob']]