def test_update_column_name_from_document_positive_nested_alias(self): logger = LstailLogger(LOG_DOCUMENT_CONFIG, output=sys.stdout, verbose=False) # alias match document_values = safe_munchify({'nested.alias': 'localhost'}) test_column_name = 'nested.test.column' test_column = LOG_DOCUMENT_COLUMNS['nested.test.column'] # test column_name = logger._update_column_name_from_document( test_column_name, test_column, document_values) # check self.assertEqual(column_name, 'nested.alias')
def test_update_column_name_from_document_positive_direct(self): logger = LstailLogger(LOG_DOCUMENT_CONFIG, output=sys.stdout, verbose=False) # direct match via column name document_values = safe_munchify({'host': 'localhost'}) test_column_name = 'host' test_column = LOG_DOCUMENT_COLUMNS['host'] # test column_name = logger._update_column_name_from_document( test_column_name, test_column, document_values) # check self.assertEqual(column_name, test_column_name)
def test_update_column_name_from_document_negative_nested(self): logger = LstailLogger(LOG_DOCUMENT_CONFIG, output=sys.stdout, verbose=False) # alias match document_values = safe_munchify({'nested.foo': 'blah'}) test_column_name = 'nested.bar' test_column = LOG_DOCUMENT_COLUMNS['host'] # test column_name = logger._update_column_name_from_document( test_column_name, test_column, document_values) # check - we get the passed column name # but the initially missing column name was added to document_values self.assertEqual(column_name, test_column_name) self.assertIn(test_column_name, document_values)