mirror of https://github.com/OpenKMIP/PyKMIP.git
Merge pull request #236 from OpenKMIP/bug/fix-sqlite-backend-multithread
Fixing a bug with multithreading support with the SQLite backend
This commit is contained in:
commit
6374f914a0
|
@ -98,7 +98,8 @@ class KmipEngine(object):
|
|||
|
||||
self._data_store = sqlalchemy.create_engine(
|
||||
'sqlite:////tmp/pykmip.database',
|
||||
echo=False
|
||||
echo=False,
|
||||
connect_args={'check_same_thread': False}
|
||||
)
|
||||
sqltypes.Base.metadata.create_all(self._data_store)
|
||||
self._data_store_session_factory = sqlalchemy.orm.sessionmaker(
|
||||
|
|
|
@ -140,6 +140,20 @@ class TestKmipEngine(testtools.TestCase):
|
|||
"""
|
||||
engine.KmipEngine()
|
||||
|
||||
@mock.patch('sqlalchemy.create_engine')
|
||||
def test_init_create_engine(self, create_engine_mock):
|
||||
"""
|
||||
Test that the right arguments are used to create the engine's SQLite
|
||||
backend.
|
||||
"""
|
||||
engine.KmipEngine()
|
||||
args = ("sqlite:////tmp/pykmip.database",)
|
||||
fargs = {
|
||||
'echo': False,
|
||||
'connect_args': {'check_same_thread': False}
|
||||
}
|
||||
create_engine_mock.assert_called_once_with(*args, **fargs)
|
||||
|
||||
def test_load_operation_policies(self):
|
||||
"""
|
||||
Test that the KmipEngine can correctly load operation policies.
|
||||
|
|
Loading…
Reference in New Issue