예제 #1
0
    def test_should_not_create_basedir_if_already_exist(self,
                                                        mock_exists, mock_mkdir, mock_logging, mock_dispatch, mock_read_stdin, mock_lock):

        commandstub.handle_execution()

        self.assertEqual(call('shtub'), mock_exists.call_args)
        self.assertEqual(None, mock_mkdir.call_args)
예제 #2
0
    def test_should_dispatch_execution(self, mock_exists, mock_mkdir, mock_logging, mock_dispatch, mock_read_stdin, mock_lock):
        commandstub.handle_execution()

        mock_dispatch.assert_called()

        expected_input = str(
            CommandInput('command', ['-arg1', '-arg2', '-arg3'], stdin=None))
        actual_execution = str(mock_dispatch.call_args[0][0])
        self.assertEqual(expected_input, actual_execution)
예제 #3
0
    def test_should_initialize_basic_logging_configuration(self,
                                                           mock_exists, mock_mkdir, mock_logging, mock_dispatch, mock_read_stdin, mock_lock):

        commandstub.handle_execution()

        self.assertEqual(call(filename=LOG_FILENAME,
                              level=logging.INFO,
                              format='%(asctime)s %(levelname)5s [%(name)s] '
                              +
                              'process[%(process)d] thread[%(thread)d] '
                              + '- %(message)s'),
                         mock_logging.call_args)