diff --git a/secure_uninstall/README.rst b/secure_uninstall/README.rst index f14968c92..90b1859aa 100644 --- a/secure_uninstall/README.rst +++ b/secure_uninstall/README.rst @@ -52,10 +52,6 @@ help us smashing it by providing a detailed and welcomed feedback. Credits ======= -Images ------- - -* Odoo Community Association: `Icon `_. Contributors ------------ diff --git a/secure_uninstall/models/module.py b/secure_uninstall/models/module.py index 7e871d695..808942557 100644 --- a/secure_uninstall/models/module.py +++ b/secure_uninstall/models/module.py @@ -7,7 +7,7 @@ from openerp.exceptions import Warning as UserError from openerp.tools.config import config -def _get_authorized_password(self): +def _get_authorized_password(): """ You can define your own authorized keys """ return [config.get("secure_uninstall")] diff --git a/secure_uninstall/tests/__init__.py b/secure_uninstall/tests/__init__.py new file mode 100644 index 000000000..ebc6337d0 --- /dev/null +++ b/secure_uninstall/tests/__init__.py @@ -0,0 +1 @@ +from . import test_uninstall diff --git a/secure_uninstall/tests/test_uninstall.py b/secure_uninstall/tests/test_uninstall.py new file mode 100644 index 000000000..18cdf3ebb --- /dev/null +++ b/secure_uninstall/tests/test_uninstall.py @@ -0,0 +1,18 @@ +# coding: utf-8 +# © 2016 David BEAL @ Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp.tests.common import TransactionCase + + +class TestSecureUninstall(TransactionCase): + + def test_secure_uninstall_without_key(self): + vals = {'uninstall_password': 'toto'} + bmu = self.env['base.module.upgrade'].create(vals) + try: + bmu.upgrade_module() + except Exception as e: + messages = ('Missing configuration key', + 'Password Error\n----------') + self.assertIn(e.message[:25], messages)