Piotr F. Mieszkowski
90da933bf9
- Provide a new reuqired parameter: [database]pooling_mode and use it during SQLAlchemy engine initialisation. - Update tests and configuration (including sample configuration). - Adjust repository unit test to load config during setup. - Pass an engine instance to repository constructors instead of connections. Engine keeps a connection pool and we rely on it.
24 lines
564 B
Python
24 lines
564 B
Python
"""Lacre identity and key repository tests."""
|
|
|
|
import unittest
|
|
|
|
import lacre.config as conf
|
|
import lacre.repositories as r
|
|
import lacre.dbschema as s
|
|
|
|
def ignore_sql(sql, *args, **kwargs):
|
|
pass
|
|
|
|
class IdentityRepositoryTest(unittest.TestCase):
|
|
|
|
def setUpClass():
|
|
# required for init_engine to work
|
|
conf.load_config()
|
|
|
|
def test_freeze_identities(self):
|
|
eng = r.init_engine('sqlite:///test/lacre.db')
|
|
|
|
ir = r.IdentityRepository(engine=eng)
|
|
identities = ir.freeze_identities()
|
|
|
|
self.assertTrue(identities)
|