def test_load_enabled_sources_invalid_log_subtype(self, log_mock): """FirehoseClient - Load Enabled Log Sources, Invalid Log Sub-type""" logs_config = {'log_type_01:sub_type_01': {}} log_type = 'log_type_01:sub_type_02' firehose_config = {'enabled_logs': [log_type]} enabled_logs = FirehoseClient.load_enabled_log_sources( firehose_config, logs_config) assert_equal(enabled_logs, dict()) log_mock.assert_called_with( 'Enabled Firehose log %s not declared in logs.json', log_type)
def test_load_enabled_sources(self): """FirehoseClient - Load Enabled Log Sources""" logs_config = { 'log_type_01:sub_type_01': {}, 'log_type_01:sub_type_02': {}, # This log type should is not enabled 'log_type_02:sub_type_01': {}, 'log_type_02:sub_type_02': {}, } firehose_config = { 'enabled_logs': [ 'log_type_01:sub_type_01', # One log for log_type_01 'log_type_02' # All of log_type_02 ] } expected_result = { 'log_type_01_sub_type_01': 'log_type_01:sub_type_01', 'log_type_02_sub_type_01': 'log_type_02:sub_type_01', 'log_type_02_sub_type_02': 'log_type_02:sub_type_02' } enabled_logs = FirehoseClient.load_enabled_log_sources( firehose_config, logs_config) assert_equal(enabled_logs, expected_result)