Looks good except the test_install_hook unit test is failing because os_release needs mocking out. I'd recommend also adding two additional tests to check that the packages are being adjusted correctly, one for pre-icehouse and one for icehouse. The icehouse could look something like:
Looks good except the test_install_hook unit test is failing because os_release needs mocking out. I'd recommend also adding two additional tests to check that the packages are being adjusted correctly, one for pre-icehouse and one for icehouse. The icehouse could look something like:
=== modified file 'unit_tests/ test_horizon_ hooks.py' test_horizon_ hooks.py 2014-04-10 16:19:57 +0000 test_horizon_ hooks.py 2014-07-25 09:26:32 +0000 preinstall' ,
--- unit_tests/
+++ unit_tests/
@@ -28,6 +28,7 @@
'unit_get',
'log',
'execd_
+ 'os_release',
'b64decode']
@@ -53,6 +54,15 @@
self. apt_update. assert_ called_ with(fatal= True)
self. apt_install. assert_ called_ with([' foo', 'bar'], fatal=True)
+ def test_install_ hook_icehouse_ pkgs(self) : release. return_ value = 'icehouse' hook('install' ) installation_ source. assert_ called_ with('distro' ) update. assert_ called_ with(fatal= True) e(pkg in self.filter_ installed_ packages. call_args) install. assert_ called( ) 'charmhelpers. core.host. file_hash' ) 'charmhelpers. core.host. service' ) charm_hook( self, _service, _hash):
+ self.os_
+ self._call_
+ self.configure_
+ self.apt_
+ for pkg in ['nodejs', 'node-less']:
+ self.assertFals
+ self.apt_
+
@patch(
@patch(
def test_upgrade_