def test_get_column_by_name_positive_direct(self): logger = LstailLogger(LOG_DOCUMENT_CONFIG, output=sys.stdout, verbose=False) # positive test - matching direct column name test_column_name = 'level' expected_column = LOG_DOCUMENT_COLUMNS[test_column_name] # check column = logger._get_column_by_name(test_column_name) self.assertEqual(column, expected_column)
def test_get_column_by_name_positive_alias(self): logger = LstailLogger(LOG_DOCUMENT_CONFIG, output=sys.stdout, verbose=False) # positive test - matching via Column.names # ("fqdn" is set as alias for "host" in LOG_DOCUMENT_COLUMNS) test_column_name = 'fqdn' expected_column = LOG_DOCUMENT_COLUMNS['host'] # check column = logger._get_column_by_name(test_column_name) self.assertEqual(column, expected_column)
def test_get_column_by_name_positive_default(self): logger = LstailLogger(LOG_DOCUMENT_CONFIG, output=sys.stdout, verbose=False) # positive test - matching via Column.names # ("fqdn" is set as alias for "host" in LOG_DOCUMENT_COLUMNS) test_column_name = 'non-existent-column-name-ABCDEFG' expected_column = Column(names=[test_column_name], color=factor_color_code(TERM_COLOR_DEFAULT), display=True, padding=None) # test column = logger._get_column_by_name(test_column_name) self.assertEqual(column, expected_column)