[IMP] base_external_dbsource_mysql: black, isort, prettier

This commit is contained in:
Víctor Martínez
2022-11-23 08:17:23 +01:00
committed by David Alonso // Solvos
parent 4ded4709a5
commit af80458cb4
2 changed files with 4 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ base_external_dbsource.BaseExternalDbsource.CONNECTORS.append(("mysql", "MySQL")
class BaseExternalDbsource(models.Model): class BaseExternalDbsource(models.Model):
""" It provides logic for connection to a MySQL data source. """ """It provides logic for connection to a MySQL data source."""
_inherit = "base.external.dbsource" _inherit = "base.external.dbsource"

View File

@@ -15,19 +15,19 @@ class TestBaseExternalDbsource(common.TransactionCase):
self.dbsource = self.env.ref("base_external_dbsource_mysql.demo_mysql") self.dbsource = self.env.ref("base_external_dbsource_mysql.demo_mysql")
def test_connection_close_mysql(self): def test_connection_close_mysql(self):
""" It should close the connection """ """It should close the connection"""
connection = mock.MagicMock() connection = mock.MagicMock()
res = self.dbsource.connection_close_mysql(connection) res = self.dbsource.connection_close_mysql(connection)
self.assertEqual(res, connection.close()) self.assertEqual(res, connection.close())
def test_connection_open_mysql(self): def test_connection_open_mysql(self):
""" It should call SQLAlchemy open """ """It should call SQLAlchemy open"""
with mock.patch.object(self.dbsource, "connection_open_mysql") as parent_method: with mock.patch.object(self.dbsource, "connection_open_mysql") as parent_method:
self.dbsource.connection_open_mysql() self.dbsource.connection_open_mysql()
parent_method.assert_called_once_with() parent_method.assert_called_once_with()
def test_excecute_mysql(self): def test_excecute_mysql(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_mysql") as parent_method: with mock.patch.object(self.dbsource, "execute_mysql") as parent_method:
self.dbsource.execute_mysql(*expect) self.dbsource.execute_mysql(*expect)