def test_main__no_exception(self, mock_config, mock_farcy): self.assertEqual(None, main()) self.assertTrue(mock_config.called) self.assertTrue(mock_farcy.called) self.assertTrue(mock_farcy.return_value.run.called)
def test_main__keyboard_interrupt_in_run(self, mock_config, mock_farcy): def side_effect(): raise KeyboardInterrupt mock_farcy.return_value.run.side_effect = side_effect self.assertEqual(0, main())
def test_main__no_repo_specified(self, mock_config): mock_config.return_value.repository = None self.assertEqual(2, main())
def test_main__farcy_exception_in_run(self, mock_config, mock_farcy): def side_effect(): raise FarcyException mock_farcy.return_value.run.side_effect = side_effect self.assertEqual(1, main())
def test_main__keyboard_interrupt_in_farcy(self, mock_config, mock_farcy): def side_effect(_): raise KeyboardInterrupt mock_farcy.side_effect = side_effect self.assertEqual(0, main())