Browse Source

[FIX] add test unit

pull/450/head
David Beal 8 years ago
parent
commit
d36b15931c
  1. 4
      secure_uninstall/README.rst
  2. 2
      secure_uninstall/models/module.py
  3. 1
      secure_uninstall/tests/__init__.py
  4. 18
      secure_uninstall/tests/test_uninstall.py

4
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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------

2
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")]

1
secure_uninstall/tests/__init__.py

@ -0,0 +1 @@
from . import test_uninstall

18
secure_uninstall/tests/test_uninstall.py

@ -0,0 +1,18 @@
# coding: utf-8
# © 2016 David BEAL @ Akretion <david.beal@akretion.com>
# 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)
Loading…
Cancel
Save