mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[MIG] base_external_dbsource_sqlite: Migration to v13.0
[UPD] Update base_external_dbsource_sqlite.pot [UPD] README.rst
This commit is contained in:
committed by
Víctor Martínez
parent
0d8425f69a
commit
cf927ca7c2
@@ -4,18 +4,16 @@ import mock
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
ADAPTER = ('odoo.addons.base_external_dbsource_sqlite.models'
|
||||
'.base_external_dbsource.sqlalchemy')
|
||||
ADAPTER = (
|
||||
"odoo.addons.base_external_dbsource_sqlite.models"
|
||||
".base_external_dbsource.sqlalchemy"
|
||||
)
|
||||
|
||||
|
||||
class TestBaseExternalDbsource(common.TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestBaseExternalDbsource, self).setUp()
|
||||
self.dbsource = self.env.ref(
|
||||
'base_external_dbsource_sqlite.demo_sqlite',
|
||||
)
|
||||
self.dbsource = self.env.ref("base_external_dbsource_sqlite.demo_sqlite")
|
||||
|
||||
def test_connection_close_sqlite(self):
|
||||
""" It should close the connection """
|
||||
@@ -26,25 +24,21 @@ class TestBaseExternalDbsource(common.TransactionCase):
|
||||
def test_connection_open_sqlite(self):
|
||||
""" It should call SQLAlchemy open """
|
||||
with mock.patch.object(
|
||||
self.dbsource, '_connection_open_sqlalchemy'
|
||||
self.dbsource, "_connection_open_sqlalchemy"
|
||||
) as parent_method:
|
||||
self.dbsource.connection_open_sqlite()
|
||||
parent_method.assert_called_once_with()
|
||||
|
||||
def test_excecute_sqlite(self):
|
||||
""" It should pass args to SQLAlchemy execute """
|
||||
expect = 'sqlquery', 'sqlparams', 'metadata'
|
||||
with mock.patch.object(
|
||||
self.dbsource, '_execute_sqlalchemy'
|
||||
) as parent_method:
|
||||
expect = "sqlquery", "sqlparams", "metadata"
|
||||
with mock.patch.object(self.dbsource, "_execute_sqlalchemy") as parent_method:
|
||||
self.dbsource.execute_sqlite(*expect)
|
||||
parent_method.assert_called_once_with(*expect)
|
||||
|
||||
def test_execute_sqlit_without_sqlparams(self):
|
||||
""" It should pass args to SQLAlchemy execute """
|
||||
expect = 'sqlquery', None, 'metadata'
|
||||
with mock.patch.object(
|
||||
self.dbsource, '_execute_sqlalchemy'
|
||||
) as parent_method:
|
||||
expect = "sqlquery", None, "metadata"
|
||||
with mock.patch.object(self.dbsource, "_execute_sqlalchemy") as parent_method:
|
||||
self.dbsource.execute_sqlite(*expect)
|
||||
parent_method.assert_called_once_with(*expect)
|
||||
|
||||
Reference in New Issue
Block a user