Esempio n. 1
0
    def test_install_packages(self, p_execute_command, p_get_os_distrib,
                              p_get_os_version):
        packages = ('git', 'emacs', 'tree')

        # test ubuntu
        p_get_os_distrib.return_value = 'ubuntu'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with(
            'RUNLEVEL=1 apt-get install -y git emacs tree', run_as_root=True)

        # test centos
        p_get_os_distrib.return_value = 'centos'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with('yum install -y git emacs tree',
                                             run_as_root=True)

        # test fedora < 22
        p_get_os_distrib.return_value = 'fedora'
        p_get_os_version.return_value = 20
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with('yum install -y git emacs tree',
                                             run_as_root=True)

        # test fedora >=22
        p_get_os_distrib.return_value = 'fedora'
        p_get_os_version.return_value = 23
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with('dnf install -y git emacs tree',
                                             run_as_root=True)

        # test redhat
        p_get_os_distrib.return_value = 'redhat'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with('yum install -y git emacs tree',
                                             run_as_root=True)
Esempio n. 2
0
    def test_install_packages(self, p_execute_command, p_get_os_distrib):
        packages = ('git', 'emacs', 'tree')

        # test ubuntu
        p_get_os_distrib.return_value = 'ubuntu'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with(
            'RUNLEVEL=1 apt-get install -y git emacs tree', run_as_root=True)

        # test centos
        p_get_os_distrib.return_value = 'centos'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with(
            'yum install -y git emacs tree',
            run_as_root=True)

        # test fedora
        p_get_os_distrib.return_value = 'fedora'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with(
            'yum install -y git emacs tree',
            run_as_root=True)

        # test redhat
        p_get_os_distrib.return_value = 'redhat'
        ssh_remote._install_packages(packages)
        p_execute_command.assert_called_with(
            'yum install -y git emacs tree',
            run_as_root=True)
Esempio n. 3
0
 def test_install_packages_bad(self, p_get_os_distrib):
     with testtools.ExpectedException(
             ex.NotImplementedException,
             'Package Installation is not implemented for OS windows me.*'):
         ssh_remote._install_packages(('git', 'emacs', 'tree'))
Esempio n. 4
0
 def test_install_packages_bad(self, p_get_os_distrib):
     with testtools.ExpectedException(
             ex.NotImplementedException,
             'Package Installation is not implemented for OS windows me.*'):
         ssh_remote._install_packages(('git', 'emacs', 'tree'))