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)
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)
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)