def test_1180(self): """print()""" with d1_test.d1_test_case.capture_std() as (out_stream, err_stream): msg = 'test_msg' cli_util.print_debug(msg) cli_util.print_error(msg) cli_util.print_warn(msg) cli_util.print_info(msg) self.sample.assert_equals(out_stream.getvalue(), 'print')
def _object_format_to_solr_filter(self, line): search_format_id = self._session.get(session.SEARCH_FORMAT_NAME) if not search_format_id or search_format_id == u'': return u'' else: if line.find(SOLR_FORMAT_ID_NAME) >= 0: cli_util.print_warn( u'Using query format restriction instead: {}'.format( search_format_id)) else: return u' %s:%s' % (SOLR_FORMAT_ID_NAME, search_format_id)
def do_exit(self, line): """exit Exit from the CLI """ n_remaining_operations = len(self._command_processor.get_operation_queue()) if n_remaining_operations: cli_util.print_warn( """There are {} unperformed operations in the write operation queue. These will be lost if you exit.""".format(n_remaining_operations) ) if not cli_util.confirm('Exit?', default='yes'): return sys.exit()
def test_1180(self): """print()""" with d1_test.d1_test_case.capture_std() as (out_stream, err_stream): msg = 'test_msg' cli_util.print_debug(msg) cli_util.print_error(msg) cli_util.print_warn(msg) cli_util.print_info(msg) assert 'DEBUG test_msg\n' \ 'ERROR test_msg\n' \ 'WARN test_msg\n' \ ' test_msg\n' == \ out_stream.getvalue()