Esempio n. 1
0
    def test_special_args(self):
        '''Make sure args like 'rpmlint > 1.0' are passed in correctly'''
        pkgs = ['foo', 'bar >= 1.0', '@group']
        install(pkgs)

        call_args = self.mock_check_output.call_args[0][0]
        assert all([pkg in call_args for pkg in pkgs])
Esempio n. 2
0
    def test_install_fails(self):
        self.mock_check_output.side_effect = self.err
        with pytest.raises(exc.CheckbError) as excinfo:
            install(['foo'])

        # direct comparison here, because isinstance() would also accept subclasses we throw for
        # different issues (missing permissions)
        assert type(excinfo.value) is exc.CheckbError
Esempio n. 3
0
 def test_no_pkgs(self):
     install([])
     assert self.mock_check_output.call_count == 0
Esempio n. 4
0
 def test_dont_add_sudo(self):
     install(['foo'])
     assert 'sudo' not in self.mock_check_output.call_args[0][0]
Esempio n. 5
0
 def test_add_sudo(self):
     self.mock_is_root.return_value = False
     install(['foo'])
     assert self.mock_check_output.call_args[0][0].index('sudo') == 0
Esempio n. 6
0
    def test_no_permissions(self):
        self.mock_is_root.return_value = False
        self.mock_has_sudo.return_value = False

        with pytest.raises(exc.CheckbPermissionError):
            install(['foo'])
Esempio n. 7
0
 def test_install_ok(self):
     install(['foo'])