예제 #1
0
    def test_main(self, mock_UploadImageService, mock_config, mock_factory):
        config = Mock()
        mock_config.return_value = config

        factory = Mock()
        mock_factory.return_value = factory

        main()
        mock_UploadImageService.assert_called_once_with(
            service_exchange='upload',
            config=config,
            custom_args={'job_factory': factory})
예제 #2
0
 def test_main_unexpected_error(self, mock_exit, mock_UploadImageService,
                                mock_config):
     mock_UploadImageService.side_effect = Exception
     main()
     mock_exit.assert_called_once_with(1)
예제 #3
0
 def test_main_system_exit(self, mock_exit, mock_UploadImageService,
                           mock_config):
     mock_UploadImageService.side_effect = SystemExit
     main()
     mock_exit.assert_called_once_with(0)
예제 #4
0
 def test_main_keyboard_interrupt(self, mock_exit, mock_UploadImageService,
                                  mock_config):
     mock_UploadImageService.side_effect = KeyboardInterrupt
     main()
     mock_exit.assert_called_once_with(0)
예제 #5
0
 def test_main_mash_error(self, mock_exit, mock_UploadImageService,
                          mock_config):
     mock_UploadImageService.side_effect = MashException('error')
     main()
     mock_exit.assert_called_once_with(1)