|
@ -10,6 +10,7 @@ import mock |
|
|
|
|
|
|
|
|
from openerp.modules import get_module_path |
|
|
from openerp.modules import get_module_path |
|
|
from openerp.tests.common import TransactionCase |
|
|
from openerp.tests.common import TransactionCase |
|
|
|
|
|
from openerp.tools import mute_logger |
|
|
|
|
|
|
|
|
from .. import post_init_hook |
|
|
from .. import post_init_hook |
|
|
|
|
|
|
|
@ -77,24 +78,19 @@ class TestModule(TransactionCase): |
|
|
|
|
|
|
|
|
def test_store_checksum_installed_state_installed(self): |
|
|
def test_store_checksum_installed_state_installed(self): |
|
|
"""It should set the module's checksum_installed equal to |
|
|
"""It should set the module's checksum_installed equal to |
|
|
checksum_dir when vals contain state 'installed'""" |
|
|
|
|
|
|
|
|
checksum_dir when vals contain a ``latest_version`` str.""" |
|
|
self.own_module.checksum_installed = 'test' |
|
|
self.own_module.checksum_installed = 'test' |
|
|
self.own_module._store_checksum_installed({'state': 'installed'}) |
|
|
|
|
|
|
|
|
self.own_module._store_checksum_installed({'latest_version': '1.0'}) |
|
|
self.assertEqual( |
|
|
self.assertEqual( |
|
|
self.own_module.checksum_installed, self.own_module.checksum_dir, |
|
|
self.own_module.checksum_installed, self.own_module.checksum_dir, |
|
|
'Setting state to installed does not store checksum_dir ' |
|
|
|
|
|
'as checksum_installed', |
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_store_checksum_installed_state_uninstalled(self): |
|
|
def test_store_checksum_installed_state_uninstalled(self): |
|
|
"""It should clear the module's checksum_installed when vals |
|
|
"""It should clear the module's checksum_installed when vals |
|
|
contain state 'uninstalled'""" |
|
|
|
|
|
|
|
|
contain ``"latest_version": False``""" |
|
|
self.own_module.checksum_installed = 'test' |
|
|
self.own_module.checksum_installed = 'test' |
|
|
self.own_module._store_checksum_installed({'state': 'uninstalled'}) |
|
|
|
|
|
self.assertEqual( |
|
|
|
|
|
self.own_module.checksum_installed, False, |
|
|
|
|
|
'Setting state to uninstalled does not clear checksum_installed', |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
self.own_module._store_checksum_installed({'latest_version': False}) |
|
|
|
|
|
self.assertIs(self.own_module.checksum_installed, False) |
|
|
|
|
|
|
|
|
def test_store_checksum_installed_vals_contain_checksum_installed(self): |
|
|
def test_store_checksum_installed_vals_contain_checksum_installed(self): |
|
|
"""It should not set checksum_installed to False or checksum_dir when |
|
|
"""It should not set checksum_installed to False or checksum_dir when |
|
@ -159,6 +155,7 @@ class TestModule(TransactionCase): |
|
|
'_store_checksum_installed', |
|
|
'_store_checksum_installed', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@mute_logger("openerp.modules.module") |
|
|
@mock.patch('%s.get_module_path' % model) |
|
|
@mock.patch('%s.get_module_path' % model) |
|
|
def test_get_module_list(self, module_path_mock): |
|
|
def test_get_module_list(self, module_path_mock): |
|
|
"""It should change the state of modules with different |
|
|
"""It should change the state of modules with different |
|
|