diff --git a/base_external_dbsource/README.rst b/base_external_dbsource/README.rst index 56549feb..636c3202 100644 --- a/base_external_dbsource/README.rst +++ b/base_external_dbsource/README.rst @@ -14,13 +14,13 @@ External Database Sources :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |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 .. |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 .. |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 |badge1| |badge2| |badge3| |badge4| |badge5| @@ -75,7 +75,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. 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 -`feedback `_. +`feedback `_. 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 promote its widespread use. -This module is part of the `OCA/server-backend `_ project on GitHub. +This module is part of the `OCA/server-backend `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_external_dbsource/i18n/base_external_dbsource.pot b/base_external_dbsource/i18n/base_external_dbsource.pot index bb80f4f4..cea7c29a 100644 --- a/base_external_dbsource/i18n/base_external_dbsource.pot +++ b/base_external_dbsource/i18n/base_external_dbsource.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -53,6 +53,11 @@ msgstr "" msgid "Client Key" 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 #: model:ir.model.fields,field_description:base_external_dbsource.field_base_external_dbsource__conn_string_full msgid "Conn String Full" diff --git a/base_external_dbsource/models/base_external_dbsource.py b/base_external_dbsource/models/base_external_dbsource.py index f0e96662..8c013845 100644 --- a/base_external_dbsource/models/base_external_dbsource.py +++ b/base_external_dbsource/models/base_external_dbsource.py @@ -95,7 +95,7 @@ class BaseExternalDbsource(models.Model): # Interface def change_table(self, name): - """ Change the table that is used for CRUD operations """ + """Change the table that is used for CRUD operations""" self.current_table = name def connection_close(self, connection): diff --git a/base_external_dbsource/static/description/index.html b/base_external_dbsource/static/description/index.html index 7b3cad00..61984643 100644 --- a/base_external_dbsource/static/description/index.html +++ b/base_external_dbsource/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/server-backend Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/server-backend Translate me on Weblate Try me on Runbot

This module allows you to define connections to foreign databases using ODBC, Firebird, Oracle Client or SQLAlchemy.

Table of contents

@@ -427,7 +427,7 @@ support larger datasets in a more efficient manner.

Bugs are tracked on GitHub Issues. 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 -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -457,7 +457,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/server-backend project on GitHub.

+

This module is part of the OCA/server-backend project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/base_external_dbsource/tests/test_base_external_dbsource.py b/base_external_dbsource/tests/test_base_external_dbsource.py index e7a8ac3b..93869f64 100644 --- a/base_external_dbsource/tests/test_base_external_dbsource.py +++ b/base_external_dbsource/tests/test_base_external_dbsource.py @@ -43,7 +43,7 @@ class TestBaseExternalDbsource(common.TransactionCase): if kwargs is None: kwargs = {} 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: adapter.side_effect = side_effect elif return_value is not None: @@ -52,7 +52,7 @@ class TestBaseExternalDbsource(common.TransactionCase): return res, adapter def test_conn_string_full(self): - """ It should add password if string interpolation not detected """ + """It should add password if string interpolation not detected""" self.dbsource.conn_string = "User=Derp;" self.dbsource.password = "password" expect = self.dbsource.conn_string + "PWD=%s;" % self.dbsource.password @@ -61,37 +61,37 @@ class TestBaseExternalDbsource(common.TransactionCase): # Interface def test_connection_success(self): - """ It should raise for successful connection """ + """It should raise for successful connection""" with self.assertRaises(ValidationError): self.dbsource.connection_test() def test_connection_fail(self): - """ It should raise for failed/invalid connection """ - with mock.patch.object(self.dbsource, "connection_open") as conn: + """It should raise for failed/invalid connection""" + with mock.patch.object(type(self.dbsource), "connection_open") as conn: conn.side_effect = Exception with self.assertRaises(ValidationError): self.dbsource.connection_test() def test_connection_open_calls_close(self): - """ It should close connection after context ends """ - with mock.patch.object(self.dbsource, "connection_close") as close: + """It should close connection after context ends""" + with mock.patch.object(type(self.dbsource), "connection_close") as close: with self.dbsource.connection_open(): pass close.assert_called_once() def test_connection_close(self): - """ It should call adapter's close method """ + """It should call adapter's close method""" args = [mock.MagicMock()] res, adapter = self._test_adapter_method("connection_close", args=args) adapter.assert_called_once_with(args[0]) def test_execute_asserts_query_arg(self): - """ It should raise a TypeError if query and sqlquery not in args """ + """It should raise a TypeError if query and sqlquery not in args""" with self.assertRaises(TypeError): self.dbsource.execute() def test_execute_calls_adapter(self): - """ It should call the adapter methods with proper args """ + """It should call the adapter methods with proper args""" expect = ("query", "execute", "metadata") return_value = "rows", "cols" res, adapter = self._test_adapter_method( @@ -100,7 +100,7 @@ class TestBaseExternalDbsource(common.TransactionCase): adapter.assert_called_once_with(*expect) def test_execute_return(self): - """ It should return rows if not metadata """ + """It should return rows if not metadata""" expect = (True, True, False) return_value = "rows", "cols" res, adapter = self._test_adapter_method( @@ -109,7 +109,7 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, return_value[0]) def test_execute_return_metadata(self): - """ It should return rows and cols if metadata """ + """It should return rows and cols if metadata""" expect = (True, True, True) return_value = "rows", "cols" res, adapter = self._test_adapter_method( @@ -118,10 +118,10 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, {"rows": return_value[0], "cols": return_value[1]}) def test_remote_browse(self): - """ It should call the adapter method with proper args """ + """It should call the adapter method with proper args""" args = [1], "args" kwargs = {"kwargs": True} - self.dbsource.current_table = "table" + type(self.dbsource).current_table = "table" res, adapter = self._test_adapter_method( "remote_browse", create=True, args=args, kwargs=kwargs ) @@ -129,19 +129,20 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, adapter()) def test_remote_browse_asserts_current_table(self): - """ It should raise AssertionError if a table not selected """ + """It should raise AssertionError if a table not selected""" args = [1], "args" kwargs = {"kwargs": True} + type(self.dbsource).current_table = False with self.assertRaises(AssertionError): res, adapter = self._test_adapter_method( "remote_browse", create=True, args=args, kwargs=kwargs ) def test_remote_create(self): - """ It should call the adapter method with proper args """ + """It should call the adapter method with proper args""" args = {"val": "Value"}, "args" kwargs = {"kwargs": True} - self.dbsource.current_table = "table" + type(self.dbsource).current_table = "table" res, adapter = self._test_adapter_method( "remote_create", create=True, args=args, kwargs=kwargs ) @@ -149,19 +150,20 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, adapter()) def test_remote_create_asserts_current_table(self): - """ It should raise AssertionError if a table not selected """ + """It should raise AssertionError if a table not selected""" args = [1], "args" kwargs = {"kwargs": True} + type(self.dbsource).current_table = False with self.assertRaises(AssertionError): res, adapter = self._test_adapter_method( "remote_create", create=True, args=args, kwargs=kwargs ) def test_remote_delete(self): - """ It should call the adapter method with proper args """ + """It should call the adapter method with proper args""" args = [1], "args" kwargs = {"kwargs": True} - self.dbsource.current_table = "table" + type(self.dbsource).current_table = "table" res, adapter = self._test_adapter_method( "remote_delete", create=True, args=args, kwargs=kwargs ) @@ -169,19 +171,20 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, adapter()) def test_remote_delete_asserts_current_table(self): - """ It should raise AssertionError if a table not selected """ + """It should raise AssertionError if a table not selected""" args = [1], "args" kwargs = {"kwargs": True} + type(self.dbsource).current_table = False with self.assertRaises(AssertionError): res, adapter = self._test_adapter_method( "remote_delete", create=True, args=args, kwargs=kwargs ) def test_remote_search(self): - """ It should call the adapter method with proper args """ + """It should call the adapter method with proper args""" args = {"search": "query"}, "args" kwargs = {"kwargs": True} - self.dbsource.current_table = "table" + type(self.dbsource).current_table = "table" res, adapter = self._test_adapter_method( "remote_search", create=True, args=args, kwargs=kwargs ) @@ -189,19 +192,20 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, adapter()) def test_remote_search_asserts_current_table(self): - """ It should raise AssertionError if a table not selected """ + """It should raise AssertionError if a table not selected""" args = [1], "args" kwargs = {"kwargs": True} + type(self.dbsource).current_table = False with self.assertRaises(AssertionError): res, adapter = self._test_adapter_method( "remote_search", create=True, args=args, kwargs=kwargs ) def test_remote_update(self): - """ It should call the adapter method with proper args """ + """It should call the adapter method with proper args""" args = [1], {"vals": "Value"}, "args" kwargs = {"kwargs": True} - self.dbsource.current_table = "table" + type(self.dbsource).current_table = "table" res, adapter = self._test_adapter_method( "remote_update", create=True, args=args, kwargs=kwargs ) @@ -209,9 +213,10 @@ class TestBaseExternalDbsource(common.TransactionCase): self.assertEqual(res, adapter()) def test_remote_update_asserts_current_table(self): - """ It should raise AssertionError if a table not selected """ + """It should raise AssertionError if a table not selected""" args = [1], "args" kwargs = {"kwargs": True} + type(self.dbsource).current_table = False with self.assertRaises(AssertionError): res, adapter = self._test_adapter_method( "remote_update", create=True, args=args, kwargs=kwargs @@ -220,10 +225,11 @@ class TestBaseExternalDbsource(common.TransactionCase): # Postgres def test_execute_postgresql(self): - """ It should call generic executor with proper args """ + """It should call generic executor with proper args""" expect = ("query", "execute", "metadata") with mock.patch.object( - self.dbsource, "_execute_generic", autospec=True + type(self.dbsource), + "_execute_generic", ) as execute: execute.return_value = "rows", "cols" self.dbsource.execute(*expect) @@ -232,10 +238,11 @@ class TestBaseExternalDbsource(common.TransactionCase): # Old API Compat def test_execute_calls_adapter_old_api(self): - """ It should call the adapter correctly if old kwargs provided """ + """It should call the adapter correctly if old kwargs provided""" expect = [None, None, "metadata"] with mock.patch.object( - self.dbsource, "execute_postgresql", autospec=True + type(self.dbsource), + "execute_postgresql", ) as psql: psql.return_value = "rows", "cols" self.dbsource.execute(*expect, sqlparams="params", sqlquery="query") @@ -243,9 +250,7 @@ class TestBaseExternalDbsource(common.TransactionCase): psql.assert_called_once_with(*expect) def test_conn_open(self): - """ It should return open connection for use """ - with mock.patch.object( - self.dbsource, "connection_open", autospec=True - ) as connection: + """It should return open connection for use""" + with mock.patch.object(type(self.dbsource), "connection_open") as connection: res = self.dbsource.conn_open() self.assertEqual(res, connection().__enter__())