mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[IMP] base_external_dbsource_mssql: black, isort, prettier
This commit is contained in:
committed by
Andrea Cattalani
parent
bf470af5eb
commit
9404269126
@@ -26,7 +26,7 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
class BaseExternalDbsource(models.Model):
|
class BaseExternalDbsource(models.Model):
|
||||||
""" It provides logic for connection to a MSSQL data source. """
|
"""It provides logic for connection to a MSSQL data source."""
|
||||||
|
|
||||||
_inherit = "base.external.dbsource"
|
_inherit = "base.external.dbsource"
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ class TestBaseExternalDbsource(common.TransactionCase):
|
|||||||
self.dbsource = self.env.ref("base_external_dbsource_mssql.demo_mssql")
|
self.dbsource = self.env.ref("base_external_dbsource_mssql.demo_mssql")
|
||||||
|
|
||||||
def test_connection_close_mssql(self):
|
def test_connection_close_mssql(self):
|
||||||
""" It should close the connection """
|
"""It should close the connection"""
|
||||||
connection = mock.MagicMock()
|
connection = mock.MagicMock()
|
||||||
res = self.dbsource.connection_close_mssql(connection)
|
res = self.dbsource.connection_close_mssql(connection)
|
||||||
self.assertEqual(res, connection.close())
|
self.assertEqual(res, connection.close())
|
||||||
|
|
||||||
def test_connection_open_mssql(self):
|
def test_connection_open_mssql(self):
|
||||||
""" It should call SQLAlchemy open """
|
"""It should call SQLAlchemy open"""
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
self.dbsource, "_connection_open_sqlalchemy"
|
self.dbsource, "_connection_open_sqlalchemy"
|
||||||
) as parent_method:
|
) as parent_method:
|
||||||
@@ -29,7 +29,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
|
|||||||
parent_method.assert_called_once_with()
|
parent_method.assert_called_once_with()
|
||||||
|
|
||||||
def test_excecute_mssql(self):
|
def test_excecute_mssql(self):
|
||||||
""" It should pass args to SQLAlchemy execute """
|
"""It should pass args to SQLAlchemy execute"""
|
||||||
expect = "sqlquery", "sqlparams", "metadata"
|
expect = "sqlquery", "sqlparams", "metadata"
|
||||||
with mock.patch.object(self.dbsource, "_execute_sqlalchemy") as parent_method:
|
with mock.patch.object(self.dbsource, "_execute_sqlalchemy") as parent_method:
|
||||||
self.dbsource.execute_mssql(*expect)
|
self.dbsource.execute_mssql(*expect)
|
||||||
|
|||||||
Reference in New Issue
Block a user