- problems with tests
 - pre-commit

[UPD] Update base_external_dbsource.pot

[UPD] README.rst
This commit is contained in:
bilbonet
2022-08-17 15:56:59 +02:00
committed by Víctor Martínez
parent 019f694ff9
commit eb489432c3
5 changed files with 55 additions and 45 deletions

View File

@@ -14,13 +14,13 @@ External Database Sources
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
:target: https://github.com/OCA/server-backend/tree/13.0/base_external_dbsource :target: https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource
:alt: OCA/server-backend :alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_external_dbsource :target: https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_external_dbsource
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/253/13.0 :target: https://runbot.odoo-community.org/runbot/253/14.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -75,7 +75,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -111,6 +111,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/13.0/base_external_dbsource>`_ project on GitHub. This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 13.0\n" "Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@@ -53,6 +53,11 @@ msgstr ""
msgid "Client Key" msgid "Client Key"
msgstr "" msgstr ""
#. module: base_external_dbsource
#: model:ir.model.fields,field_description:base_external_dbsource.field_base_external_dbsource__company_id
msgid "Company"
msgstr ""
#. module: base_external_dbsource #. module: base_external_dbsource
#: model:ir.model.fields,field_description:base_external_dbsource.field_base_external_dbsource__conn_string_full #: model:ir.model.fields,field_description:base_external_dbsource.field_base_external_dbsource__conn_string_full
msgid "Conn String Full" msgid "Conn String Full"

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/13.0/base_external_dbsource"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-base_external_dbsource"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_external_dbsource"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to define connections to foreign databases using ODBC, <p>This module allows you to define connections to foreign databases using ODBC,
Firebird, Oracle Client or SQLAlchemy.</p> Firebird, Oracle Client or SQLAlchemy.</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
@@ -427,7 +427,7 @@ support larger datasets in a more efficient manner.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20base_external_dbsource%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -457,7 +457,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/13.0/base_external_dbsource">OCA/server-backend</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/14.0/base_external_dbsource">OCA/server-backend</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -43,7 +43,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
if kwargs is None: if kwargs is None:
kwargs = {} kwargs = {}
adapter = "%s_postgresql" % method_name adapter = "%s_postgresql" % method_name
with mock.patch.object(self.dbsource, adapter, create=create) as adapter: with mock.patch.object(type(self.dbsource), adapter, create=create) as adapter:
if side_effect is not None: if side_effect is not None:
adapter.side_effect = side_effect adapter.side_effect = side_effect
elif return_value is not None: elif return_value is not None:
@@ -67,14 +67,14 @@ class TestBaseExternalDbsource(common.TransactionCase):
def test_connection_fail(self): def test_connection_fail(self):
"""It should raise for failed/invalid connection""" """It should raise for failed/invalid connection"""
with mock.patch.object(self.dbsource, "connection_open") as conn: with mock.patch.object(type(self.dbsource), "connection_open") as conn:
conn.side_effect = Exception conn.side_effect = Exception
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.dbsource.connection_test() self.dbsource.connection_test()
def test_connection_open_calls_close(self): def test_connection_open_calls_close(self):
"""It should close connection after context ends""" """It should close connection after context ends"""
with mock.patch.object(self.dbsource, "connection_close") as close: with mock.patch.object(type(self.dbsource), "connection_close") as close:
with self.dbsource.connection_open(): with self.dbsource.connection_open():
pass pass
close.assert_called_once() close.assert_called_once()
@@ -121,7 +121,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call the adapter method with proper args""" """It should call the adapter method with proper args"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
self.dbsource.current_table = "table" type(self.dbsource).current_table = "table"
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_browse", create=True, args=args, kwargs=kwargs "remote_browse", create=True, args=args, kwargs=kwargs
) )
@@ -132,6 +132,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should raise AssertionError if a table not selected""" """It should raise AssertionError if a table not selected"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
type(self.dbsource).current_table = False
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_browse", create=True, args=args, kwargs=kwargs "remote_browse", create=True, args=args, kwargs=kwargs
@@ -141,7 +142,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call the adapter method with proper args""" """It should call the adapter method with proper args"""
args = {"val": "Value"}, "args" args = {"val": "Value"}, "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
self.dbsource.current_table = "table" type(self.dbsource).current_table = "table"
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_create", create=True, args=args, kwargs=kwargs "remote_create", create=True, args=args, kwargs=kwargs
) )
@@ -152,6 +153,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should raise AssertionError if a table not selected""" """It should raise AssertionError if a table not selected"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
type(self.dbsource).current_table = False
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_create", create=True, args=args, kwargs=kwargs "remote_create", create=True, args=args, kwargs=kwargs
@@ -161,7 +163,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call the adapter method with proper args""" """It should call the adapter method with proper args"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
self.dbsource.current_table = "table" type(self.dbsource).current_table = "table"
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_delete", create=True, args=args, kwargs=kwargs "remote_delete", create=True, args=args, kwargs=kwargs
) )
@@ -172,6 +174,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should raise AssertionError if a table not selected""" """It should raise AssertionError if a table not selected"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
type(self.dbsource).current_table = False
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_delete", create=True, args=args, kwargs=kwargs "remote_delete", create=True, args=args, kwargs=kwargs
@@ -181,7 +184,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call the adapter method with proper args""" """It should call the adapter method with proper args"""
args = {"search": "query"}, "args" args = {"search": "query"}, "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
self.dbsource.current_table = "table" type(self.dbsource).current_table = "table"
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_search", create=True, args=args, kwargs=kwargs "remote_search", create=True, args=args, kwargs=kwargs
) )
@@ -192,6 +195,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should raise AssertionError if a table not selected""" """It should raise AssertionError if a table not selected"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
type(self.dbsource).current_table = False
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_search", create=True, args=args, kwargs=kwargs "remote_search", create=True, args=args, kwargs=kwargs
@@ -201,7 +205,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call the adapter method with proper args""" """It should call the adapter method with proper args"""
args = [1], {"vals": "Value"}, "args" args = [1], {"vals": "Value"}, "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
self.dbsource.current_table = "table" type(self.dbsource).current_table = "table"
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_update", create=True, args=args, kwargs=kwargs "remote_update", create=True, args=args, kwargs=kwargs
) )
@@ -212,6 +216,7 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should raise AssertionError if a table not selected""" """It should raise AssertionError if a table not selected"""
args = [1], "args" args = [1], "args"
kwargs = {"kwargs": True} kwargs = {"kwargs": True}
type(self.dbsource).current_table = False
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
res, adapter = self._test_adapter_method( res, adapter = self._test_adapter_method(
"remote_update", create=True, args=args, kwargs=kwargs "remote_update", create=True, args=args, kwargs=kwargs
@@ -223,7 +228,8 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call generic executor with proper args""" """It should call generic executor with proper args"""
expect = ("query", "execute", "metadata") expect = ("query", "execute", "metadata")
with mock.patch.object( with mock.patch.object(
self.dbsource, "_execute_generic", autospec=True type(self.dbsource),
"_execute_generic",
) as execute: ) as execute:
execute.return_value = "rows", "cols" execute.return_value = "rows", "cols"
self.dbsource.execute(*expect) self.dbsource.execute(*expect)
@@ -235,7 +241,8 @@ class TestBaseExternalDbsource(common.TransactionCase):
"""It should call the adapter correctly if old kwargs provided""" """It should call the adapter correctly if old kwargs provided"""
expect = [None, None, "metadata"] expect = [None, None, "metadata"]
with mock.patch.object( with mock.patch.object(
self.dbsource, "execute_postgresql", autospec=True type(self.dbsource),
"execute_postgresql",
) as psql: ) as psql:
psql.return_value = "rows", "cols" psql.return_value = "rows", "cols"
self.dbsource.execute(*expect, sqlparams="params", sqlquery="query") self.dbsource.execute(*expect, sqlparams="params", sqlquery="query")
@@ -244,8 +251,6 @@ class TestBaseExternalDbsource(common.TransactionCase):
def test_conn_open(self): def test_conn_open(self):
"""It should return open connection for use""" """It should return open connection for use"""
with mock.patch.object( with mock.patch.object(type(self.dbsource), "connection_open") as connection:
self.dbsource, "connection_open", autospec=True
) as connection:
res = self.dbsource.conn_open() res = self.dbsource.conn_open()
self.assertEqual(res, connection().__enter__()) self.assertEqual(res, connection().__enter__())