예제 #1
0
파일: test_main.py 프로젝트: kostyll/pakit
 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'])
예제 #2
0
파일: test_main.py 프로젝트: kostyll/pakit
 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)
예제 #3
0
파일: test_main.py 프로젝트: kostyll/pakit
 def test_no_update_needed(self, mock_plog):
     main(['pakit', '--conf', tc.TEST_CONFIG, 'update'])
     mock_plog.assert_called_with('Nothing to update.')
예제 #4
0
파일: test_main.py 프로젝트: kostyll/pakit
 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)
예제 #5
0
파일: test_main.py 프로젝트: kostyll/pakit
 def test_args_none(self, mock_sys, _):
     with pytest.raises(AttributeError):
         main(['pakit'])
     mock_sys.exit.assert_called_with(1)
예제 #6
0
파일: test_main.py 프로젝트: kostyll/pakit
 def test_normal_args(self, mock_plog):
     main(['pakit', '--conf', tc.TEST_CONFIG, 'list'])
     assert mock_plog.called
예제 #7
0
 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!")