mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[IMP] base_external_dbsource_mysql: black, isort, prettier
This commit is contained in:
@@ -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"
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
# generated from manifests external_dependencies
|
# generated from manifests external_dependencies
|
||||||
|
mysqlclient
|
||||||
pymssql<=2.2.5
|
pymssql<=2.2.5
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../base_external_dbsource_mysql
|
||||||
6
setup/base_external_dbsource_mysql/setup.py
Normal file
6
setup/base_external_dbsource_mysql/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user