diff options
Diffstat (limited to 'heat_cfntools/tests/test_cfn_helper.py')
-rw-r--r-- | heat_cfntools/tests/test_cfn_helper.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/heat_cfntools/tests/test_cfn_helper.py b/heat_cfntools/tests/test_cfn_helper.py index cc422f1..49c7206 100644 --- a/heat_cfntools/tests/test_cfn_helper.py +++ b/heat_cfntools/tests/test_cfn_helper.py @@ -76,7 +76,7 @@ class TestCommandRunner(MockPopenTestCase): class TestPackages(MockPopenTestCase): - def test_rpm_install(self): + def test_yum_install(self): install_list = [] for pack in ('httpd', 'wordpress', 'mysql-server'): self.mock_cmd_run(['su', 'root', '-c', @@ -105,6 +105,35 @@ class TestPackages(MockPopenTestCase): cfn_helper.PackagesHandler(packages).apply_packages() self.m.VerifyAll() + def test_zypper_install(self): + install_list = [] + for pack in ('httpd', 'wordpress', 'mysql-server'): + self.mock_cmd_run(['su', 'root', '-c', + 'rpm -q %s' % pack]).AndReturn( + FakePOpen(returncode=1)) + self.mock_cmd_run( + ['su', 'root', '-c', + 'zypper -n --no-refresh search %s' % pack]) \ + .AndReturn(FakePOpen(returncode=0)) + install_list.append(pack) + + self.mock_cmd_run( + ['su', 'root', '-c', + 'zypper -n install %s' % ' '.join(install_list)]) \ + .AndReturn(FakePOpen(returncode=0)) + + self.m.ReplayAll() + packages = { + "zypper": { + "mysql-server": [], + "httpd": [], + "wordpress": [] + } + } + + cfn_helper.PackagesHandler(packages).apply_packages() + self.m.VerifyAll() + def test_apt_install(self): install_list = 'httpd wordpress mysql-server' cmd = 'DEBIAN_FRONTEND=noninteractive apt-get -y install' |