def test_pakit_error(self, mock_parse): mock_parse.side_effect = PakitError('Just throw.') with pytest.raises(PakitError): main(['pakit', '--conf', tc.TEST_CONFIG, 'list'])
def test_recipe_not_found(self, mock_plog): expect = 'Missing recipe to build: iiiii' main(['pakit', '--conf', tc.TEST_CONFIG, 'install', 'iiiii']) mock_plog.assert_called_with(expect)
def test_no_update_needed(self, mock_plog): main(['pakit', '--conf', tc.TEST_CONFIG, 'update']) mock_plog.assert_called_with('Nothing to update.')
def test_args_bad(self, mock_argsys): with pytest.raises(TypeError): main(['pakit', '--conf', tc.TEST_CONFIG, 'hello']) mock_argsys.exit.assert_called_with(2)
def test_args_none(self, mock_sys, _): with pytest.raises(AttributeError): main(['pakit']) mock_sys.exit.assert_called_with(1)
def test_normal_args(self, mock_plog): main(['pakit', '--conf', tc.TEST_CONFIG, 'list']) assert mock_plog.called
def test_pakit_error_connectivity(self, mock_log, mock_con, mock_parse): mock_parse.side_effect = PakitError('Just throw.') mock_con.return_value = False main(['pakit', '--conf', tc.TEST_CONFIG, 'list']) mock_log.error.assert_any_call("Pakit can't do much without it!")