def test(mock_method):
        installer = YumInstaller()
        mock_method.return_value = []
        assert [] == installer.get_install_command(['fake'])

        # no interactive option with YUM
        mock_method.return_value = ['a', 'b']
        expected = [['sudo', 'yum', '-y', '--skip-broken', 'install', 'a', 'b']]
        val = installer.get_install_command(['whatever'], interactive=False)
        assert val == expected, val + expected
        expected = [['sudo', 'yum', '--skip-broken', 'install', 'a', 'b']]
        val = installer.get_install_command(['whatever'], interactive=True)
        assert val == expected, val + expected
Beispiel #2
0
    def test(mock_method):
        installer = YumInstaller()
        mock_method.return_value = []
        assert [] == installer.get_install_command(['fake'])

        # no interactive option with YUM
        mock_method.return_value = ['a', 'b']
        expected = [['sudo', 'yum', '-y', 'install', 'a'],
                    ['sudo', 'yum', '-y', 'install', 'b']]
        val = installer.get_install_command(['whatever'], interactive=False)
        assert val == expected, val
        expected = [['sudo', 'yum', 'install', 'a'],
                    ['sudo', 'yum', 'install', 'b']]
        val = installer.get_install_command(['whatever'], interactive=True)
        assert val == expected, val
Beispiel #3
0
    def test(expected_prefix, mock_method):
        installer = YumInstaller()
        mock_method.return_value = []
        assert [] == installer.get_install_command(['fake'])

        # no interactive option with YUM
        mock_method.return_value = ['a', 'b']
        expected = [
            expected_prefix + [
                'yum', '--assumeyes', '--quiet', '--skip-broken', 'install',
                'a', 'b'
            ]
        ]
        val = installer.get_install_command(['whatever'],
                                            interactive=False,
                                            quiet=True)
        assert val == expected, val + expected
        expected = [
            expected_prefix +
            ['yum', '--quiet', '--skip-broken', 'install', 'a', 'b']
        ]
        val = installer.get_install_command(['whatever'],
                                            interactive=True,
                                            quiet=True)
        assert val == expected, val + expected
        expected = [
            expected_prefix +
            ['yum', '--assumeyes', '--skip-broken', 'install', 'a', 'b']
        ]
        val = installer.get_install_command(['whatever'],
                                            interactive=False,
                                            quiet=False)
        assert val == expected, val + expected
        expected = [
            expected_prefix + ['yum', '--skip-broken', 'install', 'a', 'b']
        ]
        val = installer.get_install_command(['whatever'],
                                            interactive=True,
                                            quiet=False)
        assert val == expected, val + expected